gulp-es6-webpack-example
Sample setup with Gulp, Babel, Mocha and Webpack over ES6, transpiled to ES5 (source maps included).
All the code, Mocha tests and config files from Gulp and Webpack are ES6.
The is a preload bundle (to be loaded during page load time) and also a separate bundle (to be lazy loaded after the user presses a button).
The lazy-loadable bundles are automatically generated by webpack and the code is just requiring things internally using ES6/CommonJS, making it possible to avoid AMD/RequireJS for asynchronous loading.
Running gulp
will:
- Transpile ES6 code with Babel
- Run Mocha unit tests
- Package bundles with Webpack (dedupe + uglify)
See it live: run gulp server
and open http://localhost:8080/public/. Verify you have downloaded just the preload JS bundle file. Now hit the button, it will download an additional bundle file, related with that button.