A boilerplate for making npm modules, bundled with webpack and written in ES6.
- ES6 with Babel
- Bundle with Webpack
- Run tests and tdd with karma in ES6
git clone git@github.com:Stychen/npm-module-webpack-boilerplate.git <your-new-repo-name>
cd <your-repo-name>
npm install
Open up package.json and update to your liking.
Important:
Change module_name_here in package.json to your module_name.
Also in webpack.config.js, change module_name_here.
Your module's entry path is at src\index.js and the output path is at lib\<module_name>.min.js. This can be edited at webpack.config.js.
- For production
npm run buildThis will run webpack to bundle minified versions of your library in ./lib with sourcemaps.
- For development
npm startThis will run the webpack build in watch mode.
-
For testing
npm run testThis will run tests in
./testthat are named**_test.js(ie:sample_test.js). -
For test driven development
npm run tdd
This will run karma in tdd mode
After your done with development of your npm module. You can upload your module in npmjs.com https://docs.npmjs.com/getting-started/publishing-npm-packages