我的 webpack 配置中有以下定义:
new HtmlWebpackPlugin({
inject: false,
template: require('html-webpack-template'),
links: [{
rel: 'stylesheet',
href: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',
integrity: 'sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u',
crossorigin: 'anonymous'
}, {
rel: 'stylesheet',
href: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css',
integrity: 'sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp',
crossorigin: 'anonymous'
}, {
rel: 'stylesheet',
href: 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
crosorigin: 'anonymous'
}, { rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32x32.png' }],
scripts: [{
src: 'https://code.jquery.com/jquery-3.2.1.min.js',
integrity: 'sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=',
crossorigin: 'anonymous'
}, {
src: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js',
integrity: 'sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa',
crossorigin: 'anonymous'
}],
title: options.title,
appMountId: options.appMountId,
bodyHtmlSnippet: '<div id=\'demo\'></div>'
});
调用时指定“选项”值:
parts.indexTemplate({
title: 'Free Code Camp Exercises',
appMountId: 'app'
})
构建到 webpack-dev-server 和生产都完成,没有错误,我能够显示应用程序。
除了没有添加正文片段之外,所有参数都可以正常工作。
我究竟做错了什么?