1
我想使用html-webpack-plugin將我的依賴項注入到我的全局html模板中,但是到目前爲止,每次構建時,它都會返回空白,就像這樣:html-webpack-plugin不寫入index.html
Child html-webpack-plugin for "index.html":
不知道發生了什麼事情錯在這裏,任何人都可以幫忙嗎?我正在使用Webpack和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
}
}
如何輸出HTML看? (嘗試運行它沒有開發服務器爲了看到這一點) –