Skip to content

Commit 082354f

Browse files
authored
fix: filter 'template.js' in lynx (#1410)
1 parent 40ba080 commit 082354f

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

packages/types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dist"
1414
],
1515
"scripts": {
16-
"build": "tsc -p tsconfig.json",
16+
"build": "rm -f ./tsconfig.tsbuildinfo && tsc -p tsconfig.json",
1717
"dev": "npm run start",
1818
"start": "npm run build -- -w"
1919
},

packages/utils/src/common/data/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,21 @@ export class APIDataLoader {
206206
return Promise.all([
207207
this.loader.loadData('chunkGraph'),
208208
this.loader.loadData('moduleGraph'),
209+
this.loader.loadData('configs'),
209210
]).then((res) => {
210211
const { assets = [], chunks = [] } = res[0] || {};
211212
const { modules = [] } = res[1] || {};
212-
return Graph.getAllBundleData(assets, chunks, modules, [
213+
const configs = res[2] || [];
214+
215+
// Filter out */template.js assets when config name is "lynx"
216+
let filteredAssets = assets;
217+
if (Array.isArray(configs) && configs[0]?.config?.name === 'lynx') {
218+
filteredAssets = assets.filter(
219+
(asset) => !asset.path.endsWith('/template.js'),
220+
);
221+
}
222+
223+
return Graph.getAllBundleData(filteredAssets, chunks, modules, [
213224
'id',
214225
'path',
215226
'size',

pnpm-lock.yaml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)