我遵循了这个帖子
这是我的网络包
var webpack = require("webpack");
var path = require("path");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {app: './src/app.js' },
output: {filename: 'public/build/bundle.js',
sourceMapFilename: 'public/build/bundle.map' },
module: {
loaders: [
{ test: /\.(js|jsx)$/, loader: 'babel-loader',query: {
presets: ['stage-0','react','es2015'],
plugins: ["transform-decorators-legacy","transform-class-properties"]
} },
{ test: /\.css$/, loaders: [ 'style-loader', 'css-loader' ] },
{ test: /\.(eot|svg|ttf|woff|woff2)$/, loader: 'file?name=public/fonts/[name].[ext]' },
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
],
options: {
query: {
mozjpeg: {
progressive: true
},
gifsicle: {
interlaced: true
},
optipng: {
optimizationLevel: 7
}
}
}
}
]
}
}
但我仍然收到这些警告
WARNING in ./public/imgs/common/timeline/timeline.png
DEPRECATED. Configure gifsicle's interlaced option in its own options. (gifsicle.interlaced)
WARNING in ./public/imgs/common/xeditable/loading.gif
DEPRECATED. Configure gifsicle's interlaced option in its own options. (gifsicle.interlaced)
我该如何解决这个问题呢?我也看了github网址,我应用了相同的答案。但是没有用。
答案 0 :(得分:1)
我将此问题标记为重复,但在审核之前,请查看Webpack 2: WARNING in .png, .svg, .. DEPRECATED. Configure optipng's optimizationLevel option in it's own options. (optipng.optimizationLevel)。
答案 1 :(得分:-1)
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image?{bypassOnDebug:true, optipng:{optimizationLevel:7}, gifsicle:{interlaced:false}}'
]