vite: `import_meta.glob is not a function` (updating `vite@2.3.4` -> `vite@2.3.5`)

The latest release 2.3.5 breaks vite-plugin-ssr and the browser throws Uncaught TypeError: import_meta.glob is not a function.

I’m looking at what change may have led to that.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (15 by maintainers)

Commits related to this issue

Most upvoted comments

🤔 It’s still the tsconfig.json issue. esbuild uses its target to transpile .js files too. I think I need to file an issue to esbuild. This will cause much confusion.

As a workaround, you can add tsconfig.json to .npmignore to avoid it being published on npm; or better, use the files field in package.json to only publish the necessary files.

The client is not transpiled to CommonJS. If you look at node_modules/.vite/vite-plugin-ssr_client.js (after running the reproduction steps) you’ll see ES Modules, as expected.

By a matter of fact this is a bug and regression, since everything works with vite@2.3.4. Not sure if it only affects vite-plugin-ssr but import.meta.glob is not being processed as it should.

So it’s a down-/up-stream bug 😅

😀

Could you open an issue there and link it here? This will help for tracking 🙂

I’m not sure if it’s an esbuild bug, since it’s an expected breaking change. I’ll try to find some time this week to dig more what’s going on.