question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
sodateacommented, Jun 2, 2021

🤔 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.

1reaction
brilloutcommented, Jun 1, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Features | Vite
Glob Import #. Vite supports importing multiple modules from the file system via the special import.meta.glob function: js
Read more >
Vite — Resolve `import.meta.glob` in TypeScript - Future Studio
glob function allowing you to resolve files from a path. In combination with TypeScript, you may have issues that it doesn't pick up...
Read more >
webpack热加载优化及vite踩坑记录 - 掘金
3.5 The requested module 'xxx' does not provide an export named 'xx'. exports 改为export ... 3.9 import.meta.glob webpack build 报错.
Read more >
vite & react import images dynamically from public url
First you need to adjust the path that you pass to the import.meta.glob function. Specify a path relative to the file that this...
Read more >
Glob Imports in Vite - A Vue.js Lesson From our Vue.js Course:...
In this lesson, we learn how to import multiple modules at one time using a glob pattern. Matched modules can be imported either...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found