Skip to content

从开始到现在

reduce bundle size for nextjs

解决NextJs的Bundle文件的压缩问题

  1. 还是依靠webpack的compression-webpack-plugin插件
json
const CompressionPlugin = require('compression-webpack-plugin')

module.exports = {
  webpack (config) {
    config.plugins.push(new CompressionPlugin())
    
    return config
  }
}

需要注意的是,compression-webpack-plugin 的版本问题, 版本太高在打包编译时, 会报错TypeError: Cannot read property 'tapPromise' of undefined

可以将包版本降低, 以解决这种问题.

  1. blog-1 (how to reduce bundle for nextjs)

window.scrollTo

  1. target 目标元素
  2. 触发事件

MIT License.