婷婷久久综合九色综合,欧美成色婷婷在线观看视频,偷窥视频一区,欧美日本一道道一区二区

<tt id="bu9ss"></tt>
  • <span id="bu9ss"></span>
  • <pre id="bu9ss"><tt id="bu9ss"></tt></pre>
    <label id="bu9ss"></label>

    當(dāng)前位置:首頁 >  站長 >  編程技術(shù) >  正文

    詳解html-webpack-plugin使用

     2020-10-26 11:22  來源: 腳本之家   我來投稿 撤稿糾錯(cuò)

      阿里云優(yōu)惠券 先領(lǐng)券再下單

    這篇文章主要介紹了html-webpack-plugin使用,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

    最近在react項(xiàng)目中初次用到了html-webapck-plugin插件,用到該插件的兩個(gè)主要作用:

    為html文件中引入的外部資源如script、link動(dòng)態(tài)添加每次compile后的hash,防止引用緩存的外部文件問題

    可以生成創(chuàng)建html入口文件,比如單頁面可以生成一個(gè)html文件入口,配置N個(gè)html-webpack-plugin可以生成N個(gè)頁面入口

    1、安裝

    cnpm i webpack-plugin -D

    2、在webpack.config.json中引用

    const path = require('path')
    const htmlWebpackPlugin = require('html-webpack-plugin') //第一步
    module.exports = {
        entry: path.join(__dirname, './src/main.js'),
        output: {
            path: path.join(__dirname, './dist'),
            filename: 'bundle.js',
        },
        mode: 'development',
        devServer: {
            open: true,
            port: 8080,
            hot: true,
            contentBase: 'src'
        },
        plugins: [
            new htmlWebpackPlugin({ //第二步
            template: path.join(__dirname, './src/index.html'), //指定生成模板的路徑
            filename: 'index.html' //指定生成頁面的名稱
            })
        ]
    }

    3、html-webpack-plugin的作用

    一、在內(nèi)存中生成一個(gè)指定模板的文件,在訪問時(shí)速度更快

    二、自動(dòng)為指定模板文件添加bundle.js文件

    總結(jié)

    到此這篇關(guān)于詳解html-webpack-plugin使用的文章就介紹到這了,更多相關(guān)html-webpack-plugin使用內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

    來源:腳本之家

    鏈接:https://www.jb51.net/web/745178.html

    申請(qǐng)創(chuàng)業(yè)報(bào)道,分享創(chuàng)業(yè)好點(diǎn)子。點(diǎn)擊此處,共同探討創(chuàng)業(yè)新機(jī)遇!

    相關(guān)標(biāo)簽
    heml
    webpower

    相關(guān)文章

    熱門排行

    信息推薦