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'
})
],
};
请问错在哪了呢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你的这个入口文件是错误的,
jquery
之类的公共模块需要提取出来,参考一下这个插件。还有就是多页面入口和模板插件
HtmlWebpackPlugin
写成类似这样的形式更好,具体你看下这篇文章吧,写的的很详细webpack多页面的配置,不过这篇博客
webpack
还在1.*
,现在都3.5
了, 所以楼主你最好还是要自己看下文档,webpack中文官网。我之前也配了一个简单的多页面的配置文件,你可以参考下,然后在结合自己实际情况来写webpack配置
should be a string.
For example
最后怎么解决的?
我已经找到答案了