node-modules-hot
WIP to help develop local node_modules in a Meteor project.
The problem
- Local node modules have their own babel setup.
- To dev, you need to:
- Save
src file
- Run
npm run compile
- Restart Meteor
- That's a pain, so instead, on save, we:
- Run package's babel with it's babel config for just the changed file
- Hotload the changed output file back into Meteor for HMR
- Everything is still rebuilt so a full restart works too.
Assumptions
- Specific package structure:
- local babel installed as a devDependency for the package
src
(input) andlib
(output) directoriesnpm run compile
has been run at least once before so the output paths all already exist.
In general you want a layout like http://jamesknelson.com/writing-npm-packages-with-es6-using-the-babel-6-cli/ but using a .babelrc
instead of specifying options on the script command line.
See also https://github.com/gadicc/meteor-hmr/blob/master/docs/Node_Modules_Hot.md.