博客
关于我
webpack中html-webpack-plugin中的模版文件失效
阅读量:169 次
发布时间:2019-02-28

本文共 1969 字,大约阅读时间需要 6 分钟。

html-webpack-plugin?????????????

???html-webpack-plugin???????????????????????ejs???????????????????html-loader????????????????

????

html-webpack-plugin??????html????????????????html-loader????????????

  • ??????????????ejs??????
  • ??????html-loader?????????
  • ????????html-loader??

  • ?????webpack.config.js?????????html-loader
  • ??????????????
  • ??????????html-loader?????????????ejs????????
  • ??????????????????????????html-loader
  • ??????ejs????

  • ????html???????.html.ejs??
  • ?????????html?????????require??
  • ??????ejs???????require?????html-loader!??
  • ?????????html-loader?ejs?????
  • ????

    const { CleanWebpackPlugin } = require('clean-webpack-plugin');const UglifyJsPlugin = require('uglifyjs-webpack-plugin');const HtmlWebpackPlugin = require('html-webpack-plugin');module.exports = {    entry: {        index: './src/index.js',        demo: './src/demo.js',        main: './src/main.js'    },    output: {        path: path.resolve(__dirname, './dist'),        filename: 'js/[name].js'    },    mode: 'development',    plugins: [        new CleanWebpackPlugin(),        new HtmlWebpackPlugin({            chunks: ['main', 'index'],            template: 'index.html',            filename: 'index.html'        }),        new UglifyJsPlugin({            exclude: /\/main/        })    ],    module: {        rules: [            {                test: /\.(png|jpg|gif)$/,                use: [{                    loader: 'url-loader',                    options: { esModule: false }                }]            },            {                test: /\.css$/,                loader: 'style-loader'            },            {                test: /\.css$/,                loader: 'css-loader'            },            {                test: /\.html$/,                loader: 'html-loader'            }        ]    }};

    ????

  • ???????????????????????require??
  • ???????????????html?ejs?????????
  • ?????????????????????????????????
  • ?????????????html-webpack-plugin?html-loader??????????????ejs?????????

    转载地址:http://jead.baihongyu.com/

    你可能感兴趣的文章
    Mysql中存储过程、存储函数、自定义函数、变量、流程控制语句、光标/游标、定义条件和处理程序的使用示例
    查看>>
    mysql中实现rownum,对结果进行排序
    查看>>
    mysql中对于数据库的基本操作
    查看>>
    Mysql中常用函数的使用示例
    查看>>
    MySql中怎样使用case-when实现判断查询结果返回
    查看>>
    Mysql中怎样使用update更新某列的数据减去指定值
    查看>>
    Mysql中怎样设置指定ip远程访问连接
    查看>>
    mysql中数据表的基本操作很难嘛,由这个实验来带你从头走一遍
    查看>>
    Mysql中文乱码问题完美解决方案
    查看>>
    mysql中的 +号 和 CONCAT(str1,str2,...)
    查看>>
    Mysql中的 IFNULL 函数的详解
    查看>>
    mysql中的collate关键字是什么意思?
    查看>>
    MySql中的concat()相关函数
    查看>>
    mysql中的concat函数,concat_ws函数,concat_group函数之间的区别
    查看>>
    MySQL中的count函数
    查看>>
    MySQL中的DB、DBMS、SQL
    查看>>
    MySQL中的DECIMAL类型:MYSQL_TYPE_DECIMAL与MYSQL_TYPE_NEWDECIMAL详解
    查看>>
    MySQL中的GROUP_CONCAT()函数详解与实战应用
    查看>>
    MySQL中的IO问题分析与优化
    查看>>
    MySQL中的ON DUPLICATE KEY UPDATE详解与应用
    查看>>