mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
https://github.com/vercel/next.js/pull/94197 had a bug in the Turbopack case, where it didn't properly trace all necessary files referenced from `cacheHandler` and `cacheHandlers`. If you imported `lodash` in the cache handler, then - `node_modules/.pnpm/[email protected].1/node_modules/lodash/lodash.js` was correctly traced but missing were - `node_modules/.pnpm/[email protected].1/node_modules/lodash/package.json` and - `node_modules/lodash` (the symlink) The problem was that it wasn't including affecting sources of these entrypoints, because it was treating those entrypoints as bundled: ``` SingleModuleGraph::new_inner( entries: Vec<ChunkGroupEntry>, visited_modules: &FxIndexMap<ResolvedVc<Box<dyn Module>>, GraphNodeIndex>, include_traced: bool, include_binding_usage: bool, entries_are_traced: bool, // <------ problematic ) -> Result<Vc<Self>> ``` should really have been ``` SingleModuleGraph::new_inner( entries: &GraphEntries, // contains Vec<ChunkGroupEntry> and traced_modules: Vec<Modules visited_modules: &FxIndexMap<ResolvedVc<Box<dyn Module>>, GraphNodeIndex>, include_traced: bool, include_binding_usage: bool, ) -> Result<Vc<Self>> { ``` because the single `entries_are_traced: bool` can be different per entry.
23 lines
664 B
TypeScript
23 lines
664 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('app fetch build cache', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
dependencies: {
|
|
'@aws-sdk/client-s3': 'latest',
|
|
lodash: '4.18.1',
|
|
},
|
|
})
|
|
|
|
it('should render page with dependencies', async () => {
|
|
const $ = await next.render$('/')
|
|
expect($('#key').text()).toBe('Key: key1')
|
|
expect($('#isObject').text()).toBe('isObject: true')
|
|
})
|
|
|
|
it('should bundle @aws-sdk/client-s3 as a transpiled package', async () => {
|
|
const output = await next.readFile('.next/server/app/page.js')
|
|
expect(output).not.toContain('require("@aws-sdk/client-s3")')
|
|
})
|
|
})
|