Angular html网页包插件未写入index.html

Angular html网页包插件未写入index.html,angular,gulp,webpack,Angular,Gulp,Webpack,我正在尝试使用html网页包插件将依赖项注入全局html模板,但到目前为止,每次构建时,它都返回为空白,如下所示: “index.html”的子html网页包插件: 不确定这里出了什么问题,有人能帮忙吗?我正在用网页包和Angular2的Gulp import HtmlWebpack from 'html-webpack-plugin' const frontendLoader = { preloaders: { test: /\.ts$/, loade

我正在尝试使用html网页包插件将依赖项注入全局html模板,但到目前为止,每次构建时,它都返回为空白,如下所示:

“index.html”的子html网页包插件:

不确定这里出了什么问题,有人能帮忙吗?我正在用网页包和Angular2的Gulp

import HtmlWebpack from 'html-webpack-plugin'

const frontendLoader = {
    preloaders: {
        test: /\.ts$/,
        loader: 'tslint'
    },
    loaders: [{
        test: /\.ts$/,
        exclude: /node_modules/,
        loader: 'ts'
    }, {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel'
    }, {
        test: /\.html$/,
        loader: 'raw'
    }]
}
module.exports = {
    frontendConfig: {
        debug: true,
        entry: {
            initial: ['./src/js/initial/initial.js'],
            vendor: ['./src/js/app/vendor'],
            app: ['./src/js/app/index']
        },
        resolve: {
            extensions: ['', '.ts', '.js']
        },
        devtool: 'source-map',
        output: {
            filename: '[name].bundle.js'
        },
        plugins: [
            new HtmlWebpack({
                inject: 'head',
                template: './public/views/index.html'
            })
        ],
        module: frontendLoader
    }
}

在我看来,您正试图将index.html的内容包含到由HTMLWebpackPlugin生成的html文件的头部。然而,我想你真正想要的是将内容插入身体部分

而不是

plugins: [
            new HtmlWebpack({
                inject: 'head',
                template: './public/views/index.html'
            })
        ]
试一试


在我看来,您正试图将index.html的内容包含到由HTMLWebpackPlugin生成的html文件的头部。然而,我想你真正想要的是将内容插入身体部分

而不是

plugins: [
            new HtmlWebpack({
                inject: 'head',
                template: './public/views/index.html'
            })
        ]
试一试


输出html的外观如何?(尝试在没有dev server的情况下运行它以查看此内容)输出html的外观如何?(尝试在不使用dev server的情况下运行它以查看此情况)