diff --git a/packages/remax-cli/package.json b/packages/remax-cli/package.json index 4f9c50d2a..6d4c21935 100644 --- a/packages/remax-cli/package.json +++ b/packages/remax-cli/package.json @@ -27,10 +27,10 @@ "@meck/rollup-plugin-postcss": "^2.0.3", "@remax/postcss-px2units": "^0.2.0", "acorn-walk": "^7.0.0", - "babel-plugin-transform-async-to-promises": "^0.8.14", "commander": "^2.19.0", "ejs": "^2.6.1", "lodash": "^4.17.11", + "regenerator-runtime": "^0.11.0", "rollup": "^1.16.0", "rollup-plugin-alias": "^1.5.2", "rollup-plugin-babel": "^4.3.2", @@ -38,6 +38,7 @@ "rollup-plugin-commonjs": "^10.0.0", "rollup-plugin-copy": "^3.1.0", "rollup-plugin-delete": "^1.1.0", + "rollup-plugin-inject": "^3.0.1", "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-resolve": "^5.0.3", "rollup-plugin-progress": "^1.1.1", diff --git a/packages/remax-cli/src/build/rollupConfig.ts b/packages/remax-cli/src/build/rollupConfig.ts index a25e99265..a9b1386b8 100644 --- a/packages/remax-cli/src/build/rollupConfig.ts +++ b/packages/remax-cli/src/build/rollupConfig.ts @@ -9,6 +9,7 @@ import postcss from '@meck/rollup-plugin-postcss'; import progress from 'rollup-plugin-progress'; import clean from 'rollup-plugin-delete'; import alias from 'rollup-plugin-alias'; +import inject from 'rollup-plugin-inject'; import copy from 'rollup-plugin-copy'; import stub from './plugins/stub'; import pxToUnits from '@remax/postcss-px2units'; @@ -53,12 +54,6 @@ export default function rollupConfig( ], }; - if (adapter.name !== 'alipay') { - babelConfig.plugins.unshift( - require.resolve('babel-plugin-transform-async-to-promises') - ); - } - const stubModules: string[] = []; adapters.forEach(name => { @@ -196,6 +191,10 @@ export default function rollupConfig( return input.replace(/\.css/, '.css.js'); }, }), + inject({ + exclude: 'node_modules/**', + regeneratorRuntime: 'regenerator-runtime', + }), rename({ matchAll: true, map: input => { diff --git a/packages/remax-cli/typings/index.d.ts b/packages/remax-cli/typings/index.d.ts index 1e2802af0..4dfaff166 100644 --- a/packages/remax-cli/typings/index.d.ts +++ b/packages/remax-cli/typings/index.d.ts @@ -5,6 +5,7 @@ declare module 'rollup-plugin-node-resolve'; declare module 'rollup-plugin-progress'; declare module 'rollup-plugin-delete'; declare module 'rollup-plugin-alias'; +declare module 'rollup-plugin-inject'; declare module 'rollup-plugin-url'; declare module 'rollup-plugin-typescript'; declare module '@remax/postcss-px2units';