0. yarnを使う
npmの代わりにyarnでwebpackプロジェクトをbuildしてみた。
1. webpack.config
const path = require('path');
const config = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'bundle.js'
},
module: {
rules: [
{
use: 'babel-loader',
test: /\.js$/,
}
]
}
};
module.exports = config;
2. .babelrc
{
"presets": ["babel-preset-env"]
}
3. build
npm run build
のかわりにyarn run build
もしくはyarn build
でbuildができた。