• webpack管理输出


    管理html的bundle依赖

    html-webpack-plugin可以自动给html添加bundle文件

    npm install --save-dev html-webpack-plugin
    
      const path = require('path');
    + const HtmlWebpackPlugin = require('html-webpack-plugin');
    
      module.exports = {
        entry: {
          app: './src/index.js',
          print: './src/print.js'
        },
    +   plugins: [
    +     new HtmlWebpackPlugin({
    +       title: 'Output Management'
    +     })
    +   ],
        output: {
          filename: '[name].bundle.js',
          path: path.resolve(__dirname, 'dist')
        }
      };
    

    清理dist文件夹

     const path = require('path');
      const HtmlWebpackPlugin = require('html-webpack-plugin');
    + const CleanWebpackPlugin = require('clean-webpack-plugin');
    
      module.exports = {
        entry: {
          app: './src/index.js',
          print: './src/print.js'
        },
        plugins: [
    +     new CleanWebpackPlugin(['dist']),
          new HtmlWebpackPlugin({
            title: 'Output Management'
          })
        ],
        output: {
          filename: '[name].bundle.js',
          path: path.resolve(__dirname, 'dist')
        }
      };
    
    
  • 相关阅读:
    总结一下vue里一些小技巧
    vue使用过程常见的一些问题
    Vue.js 的几点总结Watchers/router key/render
    Hibernate-3
    Hibernate-2
    Hibernate-1
    百词斩一面9.17
    vivo一面凉经
    中兴技术面被怼面经
    红黑树
  • 原文地址:https://www.cnblogs.com/pluslius/p/9943312.html
Copyright © 2020-2023  润新知