博客
关于我
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 csv import meets charset
    查看>>
    multivariate_normal TypeError: ufunc ‘add‘ output (typecode ‘O‘) could not be coerced to provided……
    查看>>
    MySQL DBA 数据库优化策略
    查看>>
    multi_index_container
    查看>>
    mutiplemap 总结
    查看>>
    MySQL Error Handling in Stored Procedures---转载
    查看>>
    MVC 区域功能
    查看>>
    MySQL FEDERATED 提示
    查看>>
    mysql generic安装_MySQL 5.6 Generic Binary安装与配置_MySQL
    查看>>
    Mysql group by
    查看>>
    MySQL I 有福啦,窗口函数大大提高了取数的效率!
    查看>>
    mysql id自动增长 初始值 Mysql重置auto_increment初始值
    查看>>
    MySQL in 太多过慢的 3 种解决方案
    查看>>
    Mysql Innodb 锁机制
    查看>>
    MySQL InnoDB中意向锁的作用及原理探
    查看>>
    MySQL InnoDB事务隔离级别与锁机制深入解析
    查看>>
    Mysql InnoDB存储引擎 —— 数据页
    查看>>
    Mysql InnoDB存储引擎中的checkpoint技术
    查看>>
    Mysql InnoDB存储引擎中缓冲池Buffer Pool、Redo Log、Bin Log、Undo Log、Channge Buffer
    查看>>
    MySQL InnoDB引擎的锁机制详解
    查看>>