Skip to content

Commit

Permalink
test: repro for ERR_OUTDATED_OPTIMIZED_DEP
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Apr 17, 2024
1 parent 9487df4 commit 3d2b81b
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
1 change: 1 addition & 0 deletions playground/environment-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/vue-query": "^5.29.0",
"@vite/test-esm": "file:./deps/esm",
"@vite/test-esm-optimized": "file:./deps/esm"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { VueQueryPlugin } from '@tanstack/vue-query'
console.log(VueQueryPlugin)
41 changes: 41 additions & 0 deletions playground/environment-custom/src/repro-outdated-dep.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { fileURLToPath } from 'node:url'
import { createServer, createServerModuleRunner } from 'vite'

// node playground/environment-custom/src/repro-outdated-dep.mjs
// Error: There is a new version of the pre-bundle for "/home/hiroshi/code/others/vite/node_modules/.pnpm/@tanstack+vue-query@5.29.0/node_modules/@tanstack/vue-query/build/modern/useQueryClient.js", a page reload is going to ask for it.
// at throwOutdatedRequest (file:///home/hiroshi/code/others/vite/packages/vite/dist/node/chunks/dep-BeTFqGKC.js:3820:17)
// at TransformContext.transform (file:///home/hiroshi/code/others/vite/packages/vite/dist/node/chunks/dep-BeTFqGKC.js:11696:17)
// at async Object.transform (file:///home/hiroshi/code/others/vite/packages/vite/dist/node/chunks/dep-BeTFqGKC.js:13971:30)
// at async loadAndTransform (file:///home/hiroshi/code/others/vite/packages/vite/dist/node/chunks/dep-BeTFqGKC.js:6039:29) {
// code: 'ERR_OUTDATED_OPTIMIZED_DEP',
// plugin: 'vite:import-analysis',
// id: '/home/hiroshi/code/others/vite/node_modules/.pnpm/@tanstack+vue-query@5.29.0/node_modules/@tanstack/vue-query/build/modern/useQueryClient.js',

const server = await createServer({
clearScreen: false,
configFile: false,
root: fileURLToPath(new URL('..', import.meta.url)),
environments: {
custom: {
webCompatible: true,
resolve: {
noExternal: true,
},
dev: {
optimizeDeps: {
// --- adding either one of these to fix ---
// noDiscovery: true,
// include: ['@tanstack/vue-query'],
},
},
},
},
})

try {
// not ok
const runner = createServerModuleRunner(server.environments.custom)
await runner.import('/src/repro-outdated-dep-entry.mjs')
} finally {
await server.close()
}
34 changes: 33 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3d2b81b

Please sign in to comment.