From ce5cdba317d0a873a37bd9a4c9cc2724b2ef6518 Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 28 Jun 2022 16:32:56 +0800 Subject: [PATCH] fix: h5 framework compact option --- template/common/babel.config.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/template/common/babel.config.js b/template/common/babel.config.js index 6d0b7ce..48b7443 100644 --- a/template/common/babel.config.js +++ b/template/common/babel.config.js @@ -49,7 +49,8 @@ process.UNI_LIBRARIES.forEach(libraryName => { } ]) }) -module.exports = { + +const config = { presets: [ [ '@vue/app', @@ -60,4 +61,16 @@ module.exports = { ] ], plugins -} +} + +const UNI_H5_TEST = '**/@dcloudio/uni-h5/dist/index.umd.min.js' +if (process.env.NODE_ENV === 'production') { + config.overrides = [{ + test: UNI_H5_TEST, + compact: true, + }] +} else { + config.ignore = [UNI_H5_TEST] +} + +module.exports = config