[Webpack] Configure Prepack with Webpack

Great improvements and optimizations can be made to the output of bundled code. Prepack provides the ability to optimize code at build-time, producing run-time optimizations. In this lesson, we will look at configuring Prepack to use Webpack with the Prepack Webpack Plugin so we can enjoy extremely concise and optimized build scripts within our Webpack project.

install

yarn add prepack-webpack-plugin --dev

config:

const PrepackWebpackPlugin = require('prepack-webpack-plugin').default;

module.exports = { 
  entry: './entry.js',
  output: {
    path: __dirname,
    filename: 'bundle.js'
  },
  plugins: [
    new PrepackWebpackPlugin()
  ]
};
原文地址:https://www.cnblogs.com/Answer1215/p/6814486.html