按官方的示例,打包自定义bootStrap总是报如下错误:
ERROR in ./node_modules/bootstrap-webpack/index.loader.js!./bootstrap.config.js
Module not found: Error: Can't resolve '[object Object],[object Object]'
尝试着去掉boostrap.config.js中的styleLoader,结果又的提示:
什么.eot文件中有非法字符, Unexpected character '�'
于是加上官方示例最初的:
module.exports = {
module: {
loaders: [
// the url-loader uses DataUrls.
// the file-loader emits files.
{test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream'},
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file'},
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml'}
]
}
};
报url.js不是可执行脚本,于是想到把每个loader补充完整,写成
rules:[
{test:/\.css$/,
use:['style-loader','css-loader']
},
{
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader'
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
},
]
结果正常!但是boostrap.config.js中的styleLoader无论怎么调整都会报错。又重头读一遍 文章发现:
Install extract-text-webpack-plugin before using this configuration.
眼瞎啊,人家已经说了,在使用此配置前一定要配置extract-text-webpack-plugin,安装后依旧报错!!呵呵,你妹。我该怎么办.下载官方的示例代码,发现它的boostrap.config.js是这么写的:
styleLoader: 'style-loader!css-loader!less-loader',
回到自己的工程中,执行webpack一切正常。。心中一千万只草泥马掠过
网友评论