Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
379 views
in Technique[技术] by (71.8m points)

webpack运行服务出现图片上的错误求大神解答

//wabpack.config.js
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {

devtool: 'eval-source-map',

entry: __dirname + "/app/main.js",
output: {
    path: __dirname + "/build",
    filename: "bundle.js"
},
module: {
    loaders: [
        {
            test: /.json$/,
            loader: "json-loader"
        },
        {
            test: /.js$/,
            exclude: /node_modules/,
            loader: 'babel-loader'
            
        },
        {
            test: /.css$/,
            loader: 'style-loader!css-loader?modules!postcss'
        }
    ]
},
postcss: [
    require('autoprefixer')//调用autoprefixer插件
],

plugins:[
   new HtmlWebpackPlugin({
       template: __dirname + "/app/index.tmpl.html"
   })//在这个数组中new一个就可以了
]

}

出现的错误

clipboard.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

webpack 2配置loader时不能省略-loader,试试改为postcss-loader.

报错好像说webpack 2不允许在配置文件中自定义属性了,把autoprefixer的配置方式,参考一下这里的配置呢。
https://github.com/postcss/po...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...