4

我是 webpack 的新手,并试图弄清楚如何在 webpack-dev-server 中使用我自己的 html 文件,以及我的 webpack 构建。

在我的 app.js 中,我有:

require('!jade!index.jade')

但这并不index.html像我期望的那样。相反,似乎充其量我可以得到我的 html 的字符串输出,这不是我想要的:

var jade = require('!jade!index.jade')
jade() //outputs my html

如何让它输出 index.html 文件?如何让 webpack-dev-server 使用该 html 文件?

我还应该提到我的玉文件可能会引用手写笔文件

4

1 回答 1

9

我使用jade-html-loader和以下条目webpack.config.js

entry: ['./src/app.js', 'file?name=index.html!jade-html!./src/index.jade']

你会需要

npm install --save-dev file-loader jade-html-loader jade
于 2015-08-31T13:08:57.413 回答