Skip to content

Commit f29f1ed

Browse files
committed
fix asset import order (fr fr)
1 parent bd8d07b commit f29f1ed

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/compiler/assets.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,19 @@ export default async function collectAssetsFilePaths(entry: string): Promise<str
3232
const resolvedPath = resolveImportFileSpecifier(path.dirname(entry), filePath)
3333
return {kind, path: resolvedPath}
3434
})
35-
styleFiles.push(
36-
...resolvedImports
37-
.filter(({kind, path: filePath}) =>
38-
filePath.match(styleFilter) || filePath.match(imageFilter)
39-
)
40-
.map(({path: filePath}) => filePath)
41-
)
42-
// import all js (ts, jsx, tsx) files
4335
resolvedImports
44-
.filter(({kind, path: filePath}) =>
45-
filePath &&
46-
possibleExtensions.some(extension => filePath.endsWith(extension)) &&
47-
!filePath.startsWith(resolveProjectRoot('node_module')) &&
48-
(process.env.INTERNAL_DEV !== 'true' || !filePath.startsWith(resolveModuleRoot('src'))) // only needed during development on cc
49-
)
50-
.map(({path: filePath}) => filePath)
51-
.map(recursiveGetAllImports)
36+
.forEach(({kind, path: filePath}) => {
37+
if (filePath.match(styleFilter) || filePath.match(imageFilter)){
38+
styleFiles.push(filePath)
39+
} else if (
40+
filePath &&
41+
possibleExtensions.some(extension => filePath.endsWith(extension)) &&
42+
!filePath.startsWith(resolveProjectRoot('node_module')) &&
43+
(process.env.INTERNAL_DEV !== 'true' || !filePath.startsWith(resolveModuleRoot('src'))) // only needed during development on cc
44+
) {
45+
recursiveGetAllImports(filePath)
46+
}
47+
})
5248
}
5349
recursiveGetAllImports(entry)
5450
addMarker('asset-collector', 'end')

0 commit comments

Comments
 (0)