Open piecyk opened 4 years ago
what do you mean by library something like https://github.com/jaredpalmer/after.js?
No, something like https://github.com/transitive-bullshit/create-react-library but not using rollup to build the output, but razzle.
For example i have a react component Button
in my-app-1
package ( build with razzle ), then added my-app-2
( build with razzle client only ) and want to share that Button
between those two.
I think that would be awesome to have one tool to manage building all the pieces in monorepo.
Should be doable. A good way to understand how this should work is: https://webpack.js.org/guides/author-libraries/ . If someone tries to implement this I am all for it 😀
If you want to try hacking on this, I have a workflow:
npm install -g yalc
git clone https://github.com/jaredpalmer/razzle.git
cd razzle
git checkout -B canary
NODE_ENV=development yarn install ---ignore-engines
yarn try-example basic
# or any example in the examples dir
# or just add your own in the examples dir
cd example
yarn start
yarn build
Make changes to razzle and run:
yarn updateyalc
yarn build
yarn start
In the example dir to use your modified razzle
You can even add dependencies in the example dir with yarn
Been thinking about this and this would be awesome in monorepos. Maybe even develop component libraries with a example that reload when you edit the library live.
Maybe make buildType have library-esm library-amd library-cjs, and allow mixing like library-esm-amd-cjs
Not sure if this is a good idea. I see other projects doing libraries better, like tsdx. Could do it here for es6 but not for ts since typings is gretting too different from Babel and needs a different toolchain and deps than Babel and webpack.
🚀 Feature request
Current Behavior
There is not possible? to build library with razzle. As with rise of monorepo popularity there should be an option to easy extract a common util, or react component and build it using razzle!
Desired Behavior
Should be possible build library!
Suggested Solution
Add support for new build type to razzel, as most building blocks are there ( added with client-only support 🎉 )
Who does this impact? Who is this for?
All users.
Describe alternatives you've considered
None.
Additional context
None.