我想添加查询对巴纽/的.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]'
}
]
},
};
我在的WebPack配置了这个片段
{ test: /\.(ts|tsx)$/,
loader: ['ts-loader'],
options: { appendTsSuffixTo: [/\.vue$/] } },
当我除去[]围绕“TS-装载机”错误走了,例如
{ test: /\.(ts|tsx)$/,
loader: 'ts-loader',
options: { appendTsSuffixTo: [/\.vue$/] } },
我认为该消息说你不能使用选项/查询多个装载机。它不能是一个数组,它必须是一个单个加载器。
我面临着同样的问题,因为我发现我自己的解决方案。你可以试试:
如果你定义在“.babelrc”文件“预设”,那么你就不需要在‘webpack.config.js’文件中指定它,然后将其删除,而且运作良好
突然删除'image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false',
提出的所有警告消失。所以我想,解决它 - 尽管我不知道为什么,这是不好的:-)