GithubHelp home page GithubHelp logo

f1lt3r / babel-loader-lerna-cra Goto Github PK

View Code? Open in Web Editor NEW
30.0 4.0 9.0 11 KB

Transpile Create-React-App imports in Lerna projects.

License: MIT License

JavaScript 100.00%
create-react transpile babel-loader import lerna

babel-loader-lerna-cra's Issues

Location of Create-React-App app

Very cool utility!

I am facing some issues with the location of the react-app, however - is it a requirement to be under packages/ ?

  1. I moved it out to the root level
/
 - playground (CRA)
 - packages
   - comp-button
 - package.json

2.updated the root package.json

/
"babel-loader-lerna-cra": {
    "imports": "packages/comp-*/src",
    "apps": "*playground*"
  }
  1. ran the npx babel-loader-lerna-cra command again.
npx: installed 22 in 5.167s
babel-lerna-loader-cra: bootstraping...
babel-lerna-loader-cra: config = { lernaRoot: '/Users/me/test-lib',
  settings: { imports: 'packages/comp-*/src', apps: '*playground*' },
  apps: [ '/Users/me/test-lib/playground' ],
  imports: [ '/Users/me/test-lib/packages/comp-button/src' ] }
babel-lerna-loader-cra: copying: playground/... webpack.config.replacement.js => webpack.config.dev.js

babel-lerna-loader-cra: copying: playground/... webpack.config.replacement.js => webpack.config.prod.js

When I restarted the CRA app, it threw an error for "Module not found: Can't resolve 'comp-button' in '/Users/me/test-lib/playground/src'.

I was looking through the script, I didn't see anything that jumped out as hardcoded for /packages. Any ideas?

Bootstrap not working with react-scripts ^2.1.3

Hi, I'm unable to run the bootstrap command when using react-script 2.1.3 or higher.
This is because since v2.1.3 (or somewhere around there) the webpack.config scripts changed. There are no longer dev an prod config files and this makes the bootstrap command fail with:

ENOENT: no such file or directory, stat '...\monorepo-react\packages\react-app\node_modules\react-scripts\config\webpack.config.dev.js'

The following two config scripts now exist:

  • env.js
  • paths.js
  • webpack.config.js
  • webpackDEvServer.config.js

I know there was already a previous issue created for this very same issue, but it was closed without any real resolution: #4
Their solution was to roll-back to v2.0.5 (of react-scripts). I might do this as a temporary solution, but what are the odds you could update your utility to also support the new react-scripts configuration?

BTW, I think this utility is absolutely awesome, and I've not seen something similar yet. I really want HMR with my shared components, manually building them each time sucks.

Error: Cannot find module 'webpack'

after following tutorial on medium,

this crab happens

internal/modules/cjs/loader.js:589
    throw err;
    ^

Error: Cannot find module 'webpack'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
    at Function.Module._load (internal/modules/cjs/loader.js:513:25)
    at Module.require (internal/modules/cjs/loader.js:643:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/softmarshmallow/Desktop/launchers-react-app/packages/app/scripts/start.js:20:17)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
    at Module.load (internal/modules/cjs/loader.js:605:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
    at Function.Module._load (internal/modules/cjs/loader.js:536:3)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/start.js
Directory: /Users/softmarshmallow/Desktop/launchers-react-app/packages/app
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/softmarshmallow/Desktop/launchers-react-app/packages/app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.