在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ HtmlWebpackPlugin 處理html引入的css,js文件

HtmlWebpackPlugin 處理html引入的css,js文件

使用html-webpack-plugin,處理靜態(tài)資源,消除緩存,在webpack.config.js設置了hash:true,但是沒有效果,我的webconfig配置如下

var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var path = require("path")
module.exports = {
    entry: './a.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'static/js/build.js',
        publicPath: './',
        chunkFilename: '[name].[hash:7].js'
    },
    module: {
        loaders: [{
            test: /\.css$/,
            exclude: /node_modules/,
            loader: 'style-loader!css-loader'
        }, {
            test: /\.(png|jpg|gif)$/,
            loader: 'url-loader?limit=1000&name=static/img/[name].[hash:7].[ext]'
        }, {
            test: /\.html$/,
            exclude: /node_modules/,
            loader: 'html-loader'
        }]
    },
    plugins: [
        new HtmlWebpackPlugin({
            filename: 'index2.html',
            template: 'index.html',
            hash: true
        })
    ]
}
回答
編輯回答
柚稚

filename: 'static/js/build.js',這里沒有hash吧

2018年1月18日 18:40