webpack打包的时候报错,错在哪了
本文介绍了webpack打包的时候报错,错在哪了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
我在打包的时候报了这个错
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.entry should be one of these:
object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-empty string] | function
The entry point(s) of the compilation.
Details:
* configuration.entry['main'] should be a string.
* configuration.entry['main'] should NOT have duplicate items (items ## 0 and 1 are identical) ({
"keyword": "uniqueItems",
"dataPath": ".entry['main']",
"schemaPath": "#/definitions/common.nonEmptyArrayOfUniqueStringValues/uniqueItems",
"params": {
"i": 1,
"j": 0
},
"message": "should NOT have duplicate items (items ## 0 and 1 are identical)",
"schema": true,
"parentSchema": {
"items": {
"minLength": 1,
"type": "string"
},
"minItems": 1,
"type": "array",
"uniqueItems": true
},
"data": [
"display-modules",
"display-modules"
]
}).
[non-empty string]
* configuration.entry['main'] should be one of these:
non-empty string | [non-empty string]
* configuration.entry should be a string.
* configuration.entry should be an array:
[non-empty string]
* configuration.entry should be an instance of function
function returning an entry object or a promise..
我的配置文件是这样的
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
output: {
path: __dirname + '/build',
publicPath:'/build',
filename: '[name]_[chunkhash:8].js',
library: '[name]',
},
entry: {
"lib": ['jquery','js-cookie','icheck','store','placeholder','toastr']
},
plugins: [
new webpack.ProvidePlugin({
'jQuery': 'jquery',
'window.jQuery':'jquery'
}),
new webpack.optimize.UglifyJsPlugin({
output: {
comments: false,
},
compress: {
warnings: false
}
}),
new webpack.DllPlugin({
path: 'manifest.json',
name: '[name]',
context: __dirname,
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/layout.html',
filename: '../../templates/layout.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/order/order.html',
filename: '../../templates/order/order.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/order/pay.html',
filename: '../../templates/order/pay.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/order/wechat.html',
filename: '../../templates/order/wechat.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/register/organ-cellphone.html',
filename: '../../templates/register/organ-cellphone.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/register/organ-email.html',
filename: '../../templates/register/organ-email.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/register/organ-profile.html',
filename: '../../templates/register/organ-profile.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/register/person-profile.html',
filename: '../../templates/register/person-profile.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/register/person-register.html',
filename: '../../templates/register/person-register.html',
xhtml:true,
inject: 'head'
}),
new HtmlWebpackPlugin({
template: 'html-loader!../templates/login/logout.html',
filename: '../../templates/login/logout.html',
xhtml:true,
inject: 'head'
})
],
};
请问错在哪了呢
解决方案
我已经找到答案了
这篇关于webpack打包的时候报错,错在哪了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文