var path = require('path');

module.exports = {

entry: path.join(__dirname, 'index'),

output:{

path: __dirname,

filename: 'bundle.js',

},

module:{

rules:[

{

test: /\.css$/,

loader:['style-loader', 'css-loader']

}

]

}

};

webpack.config.js文件如上,执行命令:

webpack index.js -o bundle.js --mode=development