windows10系统,nodes:v10.22.0;npm:6.14.6; 全局taro:v2.2.8;项目中taro:2.2.8;
打包编译的时候,报错,提示检测到当前项目没有安装压缩插件 @tarojs/plugin-uglify 或 @tarojs/plugin-terser,打包时将无法压缩 JS 代码,请安装插件(安装其一即可),并且在 plugins 中进行配置!
参考文档:https://nervjs.github.io/taro/docs/config-detail#plugins
我按照提示添加了@tarojs/plugin-uglify后且配置:
plugins: [
'@tarojs/plugin-less',
'@tarojs/plugin-uglify'
],
又出现另外的异常信息:
(node:10767) UnhandledPromiseRejectionWarning: WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.optimization.minimizer[0] misses the property 'apply'.
function
-> The run point of the plugin, required method.
at webpack (/mnt/d/juliveproject/alipay_julive/node_modules/webpack/lib/webpack.js:31:9)
at /mnt/d/juliveproject/alipay_julive/node_modules/@tarojs/mini-runner/dist/index.js:37:26
at Generator.next (<anonymous>)
at fulfilled (/mnt/d/juliveproject/alipay_julive/node_modules/@tarojs/mini-runner/dist/index.js:5:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
(node:10767) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10767) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
尝试了多个taro版本,该问题始终存在。