[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()
  ]
};

 

posted @ 2017-05-05 18:37  Zhentiw  阅读(303)  评论(0编辑  收藏  举报