【发布时间】:2016-01-20 17:31:08
【问题描述】:
我正在使用 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"
})
]
};
【问题讨论】:
标签: javascript pug webpack