美文网首页
webpack4.0打包

webpack4.0打包

作者: 无花无酒_3cd3 | 来源:发表于2020-04-14 17:11 被阅读0次

    package.json

    {
      "name": "web",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start": "webpack"
      },
      "author": "",
      "license": "ISC",
      "devDependencies": {
        "html-webpack-plugin": "^3.2.0",
        "webpack": "^4.41.6",
        "webpack-cli": "^3.3.11",
        "webpack-dev-server": "^3.10.3"
      },
      "dependencies": {
        "eventemitter3": "^4.0.0",
        "jquery": "^3.4.1",
        "socket.io-client": "^2.3.0",
        "terser-webpack-plugin": "^2.3.5",
        "terser-webpack-plugin-legacy": "^1.2.3"
      }
    }
    

    webpack.config.js

    const webpack = require('webpack'); //访问内置的插件
    const path = require('path');
    module.exports={
        entry:  './src/src/index.js',  
        output: {
            filename: 'index.js',
            path: path.resolve(__dirname, 'dist')
        }, 
        // optimization: {
        //     minimizer: [new TerserPlugin({
        //         cache: true,
        //         parallel: true,
        //     })],
        //   },
    
        mode: 'production', //模式 none
    }
    

    相关文章

      网友评论

          本文标题:webpack4.0打包

          本文链接:https://www.haomeiwen.com/subject/yovtvhtx.html