相关疑难解决方法(0)

Webpack中的规则与加载器 - 有什么区别?

在一些Webpack示例中,您会看到对"rules"数组的引用:

module.exports = {
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          //resolve-url-loader may be chained before sass-loader if necessary
          use: ['css-loader', 'sass-loader']
        })
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin('style.css')
    //if you want to pass in options, you can do so:
    //new ExtractTextPlugin({
    //  filename: 'style.css'
    //})
  ]
}
Run Code Online (Sandbox Code Playgroud)

(https://github.com/webpack-contrib/extract-text-webpack-plugin)

而在另一个,加载器数组:

var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
    module: {
        loaders: [
            {
                test: /\.css$/,
                loader: ExtractTextPlugin.extract({
                    loader: "css-loader"
                })
            },
            { test: /\.png$/, …
Run Code Online (Sandbox Code Playgroud)

webpack

68
推荐指数
1
解决办法
2万
查看次数

标签 统计

webpack ×1