![](/img/trans.png)
[英]HTML-Loader is not working with Webpack 4 (appropriate loader)
[英]Webpack jade-html-loader
我正在使用webpack,并且我想将其与jade一起使用,目前我正在使用jade-html-laoder,但是当我运行webpack watch命令时,HTML文件的结果附带了所有嵌入的javascript代码。
这是我的webpack.config.js
var webpack = require('webpack'),
BrowserSyncPlugin = require('browser-sync-webpack-plugin'),
html = require('jade-html-loader'),
path = require('path');
require('es6-promise').polyfill();
module.exports = {
entry: ['./js/scripts.js', 'file?name=index.html!jade-html!./index.jade'],
output: {filename: './js/bundle.js'},
module: {
loaders: [{
test: /\.js?/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.jade$/,
loader: 'jade'
},
{
test: /\.css$/,
loader: "style!css"
},
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}]
},
plugins: [
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
server: {baseDir: './'},
reload: true,
files: "*.html"
})
]
};
您是否尝试过使用新版本? 玉现在被称为哈巴狗。
这为我工作:
module: {
loaders: [
{
test: /\.jade$/,
loader: 'pug-html-loader'
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.