还是报错,
配置文件:
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'none', // 这个必须要设置不然出现警告
context: path.join(__dirname),
devtool: debug ? "inline-sourcemap" : null,
//入口文件
entry: "./src/js/index.js",
module: {
rules: [
{
test: /\.js?$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015'],
plugins: ['react-html-attrs']
}
},
{
test: /\.css$/,
// loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
loader: 'style-loader!css-loader'
}
]
},
//输出文件
output: {
path: __dirname,
filename: "./src/bundle.js"
},
plugins: [
new HtmlWebpackPlugin({template: './index.html'})
]
};
我的整个项目的目录结构和跟老师的排版一致的