html-webpack-template选项bodyhtmlsnippet对我不起作用



我在我的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和生产都没有错误,我可以显示该应用程序。

所有参数都可以正常工作,未添加身体nippet。

我在做什么错?

事实证明我在插件的5.x版本上;Bodyhtmlsnippet是一个非常新的选择,仅在6.1行中可用。

相关内容

  • 没有找到相关文章

最新更新