Webpack 2: Error: options/query cannot be used with loaders (use options for each array item)

Webpack 2: Error: options/query cannot be used with loaders (use options for each array item)

我正在尝试为 .png/.ttf 加载添加查询,因为 webpack 否则在升级到 webpack 2 后编译时会给我关于弃用的警告。

这是我的配置。如何正确添加对照片和字体的查询?

const ExtractTextPlugin = require("extract-text-webpack-plugin");

var webpack = require("webpack");

module.exports = {
    entry: {
        dashboard: './js/main.js',
        vendor: ["fixed-data-table","react","react-dom","jquery", "bootstrap", "vis"],
    },
    output: { path: "../public", filename: 'bundle.js' },

    plugins: [
        new webpack.optimize.CommonsChunkPlugin({name: "vendor", filename: "static/vendor.bundle.js"}),
        new ExtractTextPlugin("/static/[name].css"),
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery"
        }),
    ],

    module: {
        loaders: [
            {
                test: /.js?$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
                query: {
                    presets: [
                        'es2015', 'react', 'stage-0',
                    ],

            }
            },
            {
                test: /\.css$/,
                loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader'}),
            },
            {
                test: /\.(jpe?g|png|gif|svg)$/i,
                loaders: [
                    'file-loader?hash=sha512&digest=hex&name=~/.local/share/Trash/[hash].[ext]',
                    'image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false', {
                        loader: 'image-webpack-loader',
                    },
                ],
                query: {
                    gifsicle: {
                        interlaced: false,
                    },
                    optipng: {
                        optimizationLevel: 4,
                    },
                    pngquant: {
                        quality: '75-90',
                        speed: 3,
                    },
                }

            },
            {
                test: /\.(eot|svg|ttf|woff|woff2)$/,
                loader: 'file-loader?name=~/.local/share/Trash/[name].[ext]'
            }
        ]
    },
};

删除 'image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false', 突然让所有警告都消失了。所以我想这解决了它 - 虽然我不确定为什么,这不好:-)

我的 webpack 配置中有这个片段

 { test: /\.(ts|tsx)$/,
  loader: ['ts-loader'],
  options: { appendTsSuffixTo: [/\.vue$/] } }, 

当我删除 'ts-loader' 周围的 [] 时,错误消失了,例如

 { test: /\.(ts|tsx)$/,
  loader: 'ts-loader',
  options: { appendTsSuffixTo: [/\.vue$/] } }, 

我认为消息是说您不能对多个加载程序使用 options/query。不能是数组,必须是单个loader。