Skip to content

Commit

Permalink
feat(platform-loader): support excludePlatformMap
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftj18 committed Aug 22, 2023
1 parent e7c9393 commit e04f1c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/platform-loader/src/TraverseImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const platformMap = {
module.exports = function traverseImport(options, inputSource, sourceMapOption) {
let specified; // Collector import specifiers
const { sourceFileName } = sourceMapOption;
const { platform, name: libNames, memberExpObjName, platformMap: userPlatformMap } = options;
const { platform, name: libNames, memberExpObjName, platformMap: userPlatformMap, excludePlatformMap } = options;

// merge user platformMap
userPlatformMap &&
Expand All @@ -42,6 +42,15 @@ module.exports = function traverseImport(options, inputSource, sourceMapOption)
return map;
}, {});

// ignore platform variable
if (excludePlatformMap && excludePlatformMap[platform]) {
excludePlatformMap[platform].forEach((v) => {
if (typeof platformVarMap[v] !== 'undefined') {
delete platformVarMap[v];
}
});
}

/**
* generator variable expression
*
Expand Down

0 comments on commit e04f1c3

Please sign in to comment.