zoukankan      html  css  js  c++  java
  • Webpack

    Webpack是一个针对JavaScript应用的打包工具,它按以下步骤来执行打包过程:

    1. 第归的扫描应用
    2. 根据扫描为应用构造一个包括所有模块的依赖关系图
    3. 根据关系图打包所有模块到一个或多个捆绑保(bundles)

    Webpack包括4个核心概念

    • 入口(Entry)
    • 输出(Output)
    • 装载(Loaders)
    • 插件(Plugins)

    请参看下面例子:

    const HtmlWebpackPlugin = require('html-webpack-plugin'); //installed via npm
    const webpack = require('webpack'); //to access built-in plugins
    const path = require('path');
    
    const config = {
      entry: './path/to/my/entry/file.js',
      output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'my-first-webpack.bundle.js'
      },
      module: {
        rules: [
          { test: /.txt$/, use: 'raw-loader' }
        ]
      },
      plugins: [
        new webpack.optimize.UglifyJsPlugin(),
        new HtmlWebpackPlugin({template: './src/index.html'})
      ]
    };
    
    module.exports = config;
  • 相关阅读:
    博客地址
    node学习2
    正则表达式总结
    Git命令操作
    IDEA快捷键
    hibernate多对多(权限管理)
    所有国家的下拉框英文全称
    所有国家的下拉框英文简写
    所有国家的下拉框中文
    poj-1248 Safecracker
  • 原文地址:https://www.cnblogs.com/jinzd/p/7770628.html
Copyright © 2011-2022 走看看