Skip to content

Commit

Permalink
fix: fix cross import between optimized modules and avoid duplication
Browse files Browse the repository at this point in the history
fix #210
  • Loading branch information
yyx990803 committed May 20, 2020
1 parent 0f41b06 commit eedc985
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/node/depOptimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export async function optimizeDeps(
...config.rollupOutputOptions,
format: 'es',
exports: 'named',
entryFileNames: '[name]',
chunkFileNames: 'common/[name]-[hash].js'
})

Expand Down
1 change: 0 additions & 1 deletion src/node/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export function resolveOptimizedModule(
return cached
}

if (!id.endsWith('.js')) id += '.js'
const cacheDir = resolveOptimizedCacheDir(root)
if (!cacheDir) return
const file = path.join(cacheDir, id)
Expand Down
2 changes: 1 addition & 1 deletion src/node/utils/fsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function cachedRead(
const cached = moduleReadCache.get(file)
if (ctx) {
ctx.set('Cache-Control', 'no-cache')
ctx.type = path.basename(file)
ctx.type = path.extname(file) || 'js'
}
if (cached && cached.lastModified === lastModified) {
if (ctx) {
Expand Down

0 comments on commit eedc985

Please sign in to comment.