oss webpack plugin
webpack插件,将打包的静态资源上传至oss(仅限阿里云)
在next.js项目中使用
- 安装
npm install next-oss-webpack-plugin --save-dev
- 配置
next.config.js
const NextOSSPlugin = ; const isProd = processenvNODE_ENV === 'production';const assetPrefix = isProd ? 'https://cdn.domain.com/path' : ''; // path自定义 moduleexports = assetPrefix { if isProd && buildId configplugins; return config; }