You can start with a simple webpack config taking your current js assets and bundling them with a babel loader. Install webpack, babel-loader, babel-core and babel-preset-es2015 via npm.
webpack.config.js
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: './main.js',
output: { path: __dirname, filename: 'bundle.js' },
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015']
}
}
]
},
};
You can specify multiple entry points. This should be enough to get started. Next step you can add
- Webpack-dev-server for development and hot module replacement
- Production config with UglifyJS plugin for optimal build size
- Bundle assets like fonts and image
- Bundle css/scss with post-processor (e.g. autoprefixer)
The docs will be a great help on how to choose the best plugin, config, CLI flag, etc.