Skip to content

Commit

Permalink
fix(optimizer): entry matching for .mjs entries
Browse files Browse the repository at this point in the history
fix #1739
  • Loading branch information
yyx990803 committed Jan 27, 2021
1 parent c91dbe8 commit ebe71c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vite/src/node/optimizer/index.ts
Expand Up @@ -130,15 +130,16 @@ export async function optimizeDeps(
}

for (const output in meta.outputs) {
if (/\.vite[\/\\]chunk\.\w+\.js$/.test(output) || output.endsWith('.map'))
if (/\.vite[\/\\]chunk\.\w+\.js$/.test(output) || output.endsWith('.map')) {
continue
}
const { inputs, exports } = meta.outputs[output]
const relativeOutput = normalizePath(
path.relative(cacheDir, path.resolve(output))
)
for (const input in inputs) {
const entry = normalizePath(path.resolve(input))
if (!entry.endsWith(relativeOutput)) {
if (!entry.replace(/\.mjs$/, '.js').endsWith(relativeOutput)) {
continue
}
const id = entryToIdMap[entry.toLowerCase()]
Expand Down

0 comments on commit ebe71c4

Please sign in to comment.