Skip to content

Commit bfad544

Browse files
committed
fix: import from component library
close #15
1 parent 547f053 commit bfad544

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

template/javascript/build.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ async function resolvePeer(module) {
4444
}
4545
}
4646

47+
const builtLibraries = [];
4748
const bundledModules = new Set();
4849
async function bundleModule(module) {
49-
if (bundledModules.has(module)) return;
50+
if (
51+
bundledModules.has(module) ||
52+
builtLibraries.some((library) => module.startsWith(library))
53+
) {
54+
return;
55+
}
5056
bundledModules.add(module);
5157

5258
const peer = await resolvePeer(module);
@@ -114,6 +120,7 @@ async function buildComponentLibrary(name) {
114120

115121
if (!source) return;
116122

123+
builtLibraries.push(name);
117124
const destination = path.resolve('dist', 'miniprogram_npm', name);
118125
await fs.copy(source, destination);
119126

template/typescript/build.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ async function resolvePeer(module) {
4444
}
4545
}
4646

47+
const builtLibraries = [];
4748
const bundledModules = new Set();
4849
async function bundleModule(module) {
49-
if (bundledModules.has(module)) return;
50+
if (
51+
bundledModules.has(module) ||
52+
builtLibraries.some((library) => module.startsWith(library))
53+
) {
54+
return;
55+
}
5056
bundledModules.add(module);
5157

5258
const peer = await resolvePeer(module);
@@ -114,6 +120,7 @@ async function buildComponentLibrary(name) {
114120

115121
if (!source) return;
116122

123+
builtLibraries.push(name);
117124
const destination = path.resolve('dist', 'miniprogram_npm', name);
118125
await fs.copy(source, destination);
119126

0 commit comments

Comments
 (0)