第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

webpack 啟用熱更新后 如何避免每次都生成描述文件json和補丁文件js

webpack 啟用熱更新后 如何避免每次都生成描述文件json和補丁文件js

慕斯王 2019-03-15 18:15:27
var path = require("path");var CleanWebpackPlugin = require('clean-webpack-plugin');var HtmlWebpackPlugin = require('html-webpack-plugin');var webpack = require('webpack'); // 引入 webpack 便于調(diào)用其內(nèi)置插件// console.log(CleanWebpackPlugin);module.exports = {  devtool: 'inline-source-map',    devServer: {        contentBase: path.resolve(__dirname, 'dist/js'),        hot: true, // 告訴 dev-server 我們在用 HMR        hotOnly: true, // 指定如果熱加載失敗了禁止刷新頁面 (這是 webpack 的默認行為),這樣便于我們知道失敗是因為何種錯誤        inline:true,    },    entry: {        print:'./src/js/print.js',        index:'./src/js/index.js'    },    module:{      rules:[        {          test:/\.css$/,          use:['style-loader','css-loader']        },      ]    },    plugins: [      new CleanWebpackPlugin(['dist']),      new HtmlWebpackPlugin({            title: 'Output Management',            inject:'head',            filename:'index.html',            template:'index.html'      }),        new webpack.NamedModulesPlugin(),        new webpack.HotModuleReplacementPlugin()    ],    output: {        path: path.resolve(__dirname,'./dist'),        filename: '[name].bundle.js',        // chunkFilename:'[name].bundle.js',    },};每次都會生成這些文件 如何配置不生成呢
查看完整描述

1 回答

?
寶慕林4294392

TA貢獻2021條經(jīng)驗 獲得超8個贊

Those HMR chunks are created by HotModuleReplacementPlugin when we use --watch flag running webpack:

webpack -d --watch


The best way I found till now is to define specific folder and file for those chunks. We can do this in the output section, for example:


output: {

    path: path.join(root, "dist"),

    filename: "bundle.js",

    hotUpdateChunkFilename: 'hot/hot-update.js',

    hotUpdateMainFilename: 'hot/hot-update.json'

}

After this change, we will have only those two files created. So we can simply add them (or whole folder) to the .gitignore.


I know It's not the best solution, but I didn't found anything better for now.


查看完整回答
反對 回復 2019-03-22
  • 1 回答
  • 0 關注
  • 555 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號