f1lt3r / babel-loader-lerna-cra Goto Github PK
View Code? Open in Web Editor NEWTranspile Create-React-App imports in Lerna projects.
License: MIT License
Transpile Create-React-App imports in Lerna projects.
License: MIT License
Very cool utility!
I am facing some issues with the location of the react-app, however - is it a requirement to be under packages/ ?
/
- playground (CRA)
- packages
- comp-button
- package.json
2.updated the root package.json
/
"babel-loader-lerna-cra": {
"imports": "packages/comp-*/src",
"apps": "*playground*"
}
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?
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:
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.
After setting up my babel-loader-lerna-cra
's configurations, the loader is able to find the locations of my react app (CRA, not ejected), however it couldn't the webpack.config
js-es
Is this the expected behaviour?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.