qq_啊啦嘞_0
2018-09-19 21:50
课程里关于webpack的配置是低版本的,对高版本的不适用?
这里的配置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' }) ] }
有的是适用的,只不过在安装的时候,需要局部安装一下
webpack深入与实战
86561 学习 · 721 问题
相似问题