!518 allowthiskeyword

Merge pull request !518 from 卡哥/master
This commit is contained in:
openharmony_ci 2023-02-07 06:24:46 +00:00 committed by Gitee
commit da0f990e3e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 21 additions and 10 deletions

View File

@ -18,20 +18,26 @@ module.exports = function(api) {
const presets = ['@babel/preset-env'];
const plugins = [
[
'@babel/plugin-transform-modules-commonjs',
{'allowTopLevelThis': true}
],
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime',
];
if (process.env.DEVICE_LEVEL === 'lite') {
plugins.push([
const liteArray = [
'@babel/plugin-transform-runtime',
[
'@babel/plugin-transform-arrow-functions',
{
spec: true,
},
]);
{spec: true},
]
]
plugins.push(...liteArray);
}
return {
presets,
plugins,
comments: false
};
};

View File

@ -93,8 +93,13 @@ const richModule = {
options: {
presets: [util.loadBabelModule('@babel/preset-env')],
targets: 'node 8',
plugins: [util.loadBabelModule('@babel/plugin-transform-modules-commonjs'),
util.loadBabelModule('@babel/plugin-proposal-class-properties')],
plugins: [
[
util.loadBabelModule('@babel/plugin-transform-modules-commonjs'),
{'allowTopLevelThis': true}
],
util.loadBabelModule('@babel/plugin-proposal-class-properties')
],
compact: false
}
}