diff --git a/generator.js b/generator.js index 8f75990..7219c41 100644 --- a/generator.js +++ b/generator.js @@ -39,19 +39,12 @@ module.exports = (api, options, rootOptions) => { ] api.extendPackage(pkg => { return { - dependencies: { - 'regenerator-runtime': '^0.12.1',// 锁定版本,避免高版本在小程序中出错 - '@dcloudio/uni-helper-json': '*' - }, devDependencies: { - "@babel/runtime": "~7.17.9",// 临时指定版本,7.13.x 会报错 - 'postcss-comment': '^2.0.0', + '@dcloudio/uni-helper-json': '*', '@dcloudio/types': '^3.0.4', 'miniprogram-api-typings': '*', - 'mini-types': '*' - }, - resolutions: { - "@babel/runtime": "~7.17.9" + 'mini-types': '*', + 'postcss-comment': '^2.0.0' } } }) diff --git a/template/common/babel.config.js b/template/common/babel.config.js index 2b9ae2d..4c1134b 100644 --- a/template/common/babel.config.js +++ b/template/common/babel.config.js @@ -51,6 +51,10 @@ process.UNI_LIBRARIES.forEach(libraryName => { ]) }) +if (process.env.UNI_PLATFORM !== 'h5') { + plugins.push('@babel/plugin-transform-runtime') +} + const config = { presets: [ [