簡體   English   中英

Webpack Jade-html-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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM