Install:
npm install --save-dev babel-loader
webpack.config.js:
Add module, tell webpack to find all js file and use babel as loader, exclude all files in node_modules
module.exports = { entry: { app: [‘./app/index.js‘] }, output: { path: ‘./build‘, filename: ‘bundle.js‘ }, module: { loaders: [ {test: /\.js$/, loader: ‘babel‘, exclude: /node_modules/} ] } };
时间: 2024-10-17 06:47:54