# Build Performance

# The Basic

  • stay up to the lastest webpack and node version
  • Use the include field to only apply the loader modules that actually need to be transformed by it
const path = require('path');
module.exports = {
  //...
  module: {
    rules: [
      {
        test: /\.js$/,
        include: path.resolve(__dirname, 'src'),
        loader: 'babel-loader',
      },
    ],
  },
};
  • increase resolving(解析) speed
  • Use the DllPlugin to move code that is changed less often into a separate compilation, it improve the application's compilation speed
  • Try to keep chunks small by SplitChunksPlugin

# Development

  • webpack's watch mode
  • webpack-dev-server
Last Updated: 2022/6/27 上午10:07:30