课程里关于webpack的配置是低版本的,对高版本的不适用?
课程里关于webpack的配置是低版本的,对高版本的不适用?
课程里关于webpack的配置是低版本的,对高版本的不适用?
2018-09-19
这里的配置webpack4下是可以运行的
var htmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { mode: 'development', entry: __dirname + '/src/app.js', output: { path: __dirname + "/dist", filename: "js/[name].bundle.js", }, module: { rules: [ { test: /\.js$/, exclude: '/node_modules/', loader: "babel-loader" }, { test: /\.css/, use: [ 'style-loader', 'css-loader?importLoaders=1', { loader: 'postcss-loader', options: { plugins: [ require('autoprefixer')({ browsers: [ "last 10 version" ] }), ], } } ] }, { test: /\.less$/, use: [ 'style-loader', 'css-loader', { loader: 'postcss-loader', options: { plugins: [ require('autoprefixer')({ browsers: [ "last 10 version" ] }), ], } }, { loader: "less-loader", options: { sourceMap: true }// compiles Less to CSS }] }, { test: /\.scss$/, use: [ "style-loader", // creates style nodes from JS strings "css-loader", { loader: 'postcss-loader', options: { plugins: [ require('autoprefixer')({ browsers: [ "last 10 version" ] }), ], } },// translates CSS into CommonJS "sass-loader" // compiles Sass to CSS, using Node Sass by default ] } ] }, plugins: [ new htmlWebpackPlugin({ filename: 'index.html', template: './src/index.html', inject: 'body' }) ] }
举报