Skip to content

Commit dc74534

Browse files
committed
Merge branch 'feat/jsx2mp-runtime-alias' into stable/fliggy-beta
2 parents 20defa7 + 7279325 commit dc74534

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/miniapp-compile-config/src/plugins/CopyJsx2mpRuntime.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ module.exports = class JSX2MPRuntimePlugin {
3737
compiler.hooks.emit.tapAsync(
3838
'JSX2MPRuntimePlugin',
3939
(compilation, callback) => {
40+
let runtimeName = runtime;
4041
if (!runtimePackageJSONPath) {
41-
runtimePackageJSONPath = getHighestPriorityPackageJSON(runtime, this.rootDir);
42+
const rootDirPackageJSON = readJSONSync(join(this.rootDir, 'package.json'));
43+
if (rootDirPackageJSON.clam && rootDirPackageJSON.clam.raxJsLibAlias && rootDirPackageJSON.clam.raxJsLibAlias[runtime]) {
44+
runtimeName = rootDirPackageJSON.clam.raxJsLibAlias[runtime];
45+
}
46+
runtimePackageJSONPath = getHighestPriorityPackageJSON(runtimeName, this.rootDir);
4247
runtimePackageJSON = readJSONSync(runtimePackageJSONPath);
4348
runtimePackagePath = join(runtimePackageJSONPath, '..');
4449
}
45-
const runtimeTargetPath = `dist/jsx2mp-runtime.${this.platform}.esm.js`;
50+
const runtimeTargetPath = `dist/${runtimeName}.${this.platform}.esm.js`;
4651
const sourceFile = require.resolve(join(runtimePackagePath, runtimeTargetPath));
4752
const targetFile = join(this.outputPath, 'npm', runtime + '.js');
4853

0 commit comments

Comments
 (0)