Skip to content

Commit 8a9522c

Browse files
authored
Merge pull request #3031 from modernweb-dev/fix/consistent-order-of-switch-cases
fix(@web/rollup-plugin-import-meta-assets): consistent order of switch cases
2 parents 1ea4af2 + 2c2f92e commit 8a9522c

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

.changeset/good-rockets-reflect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@web/rollup-plugin-import-meta-assets': patch
3+
---
4+
5+
sort glob to ensure the order of switch cases and consistent build output for same files

packages/rollup-plugin-import-meta-assets/src/rollup-plugin-import-meta-assets.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ function importMetaAssets({ include, exclude, warnOnError, transform } = {}) {
105105
const { globby } = await import('globby');
106106
// execute the glob
107107
const result = await globby(glob, { cwd: path.dirname(id) });
108-
const paths = result.map(r =>
109-
r.startsWith('./') || r.startsWith('../') ? r : `./${r}`,
110-
);
108+
const paths = result
109+
.sort()
110+
.map(r => (r.startsWith('./') || r.startsWith('../') ? r : `./${r}`));
111111

112112
// create magic string if it wasn't created already
113113
ms = ms || new MagicString(code);

0 commit comments

Comments
 (0)