Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__vite__mapDeps is not defined #15702

Closed
7 tasks done
Bubz43 opened this issue Jan 24, 2024 · 7 comments · Fixed by #15732
Closed
7 tasks done

__vite__mapDeps is not defined #15702

Bubz43 opened this issue Jan 24, 2024 · 7 comments · Fixed by #15732
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release

Comments

@Bubz43
Copy link

Bubz43 commented Jan 24, 2024

Describe the bug

Production builds with dynamic imports will error with __vite__mapDeps is not defined. Looking into the build output, it appears that the __vite__mapDeps function is getting injected into a template literal css string, which is used by @material/web for their component styles, instead of elsewhere to be available to other functions.

Reproduction

https://stackblitz.com/edit/vitejs-vite-igey3u?file=dist%2Fassets%2Findex-WzX_qdTi.js

Steps to reproduce

Run vite build then vite preview

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.14.0 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^5.0.12 => 5.0.12

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented Jan 24, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@hi-ogawa
Copy link
Collaborator

hi-ogawa commented Jan 24, 2024

Thanks for the reproduction and putting build output is very helpful.

It's likely that this is a regression from #15483. Currently __vite__mapDeps is injected by targeting /*# sourceMapping ... comment, but probably the regex picked up wrong thing in css. In your case, sourcemap is not even enabled, so that's probably another thing which could've been checked.

@bluwy bluwy added p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release and removed bug labels Jan 24, 2024
luwes added a commit to muxinc/media-chrome that referenced this issue Feb 1, 2024
This change adds a docs examples page with Sandpack. 
The examples are pulled from the examples/vanilla folder.
This is just a start, would like to add more and more examples.

The HTML is editable and for the themes one can also edit the theme in
place and open it up in Sandbox for keeping their own copy for example.

The goal is to show off more with the cool things that can be easily
build with media-chrome and to be easier discoverable.


https://media-chrome-docs-git-fork-luwes-docs-upgrade-mux.vercel.app/docs/en/examples

---

Upgrades the docs dependencies and Astro to v4.

Vite has a regression which is reported here
vitejs/vite#15702 which Astro runs into
together with the React Sandpack library. So I pinned it to vite 5.0.10
to get around that.

Sandpack has a regression which I submitted an issue for here:
codesandbox/sandpack#1068

The rest seemed to work, a few more warnings in the CLI when building.
luwes added a commit to muxinc/media-chrome that referenced this issue Feb 1, 2024
This change adds a docs examples page with Sandpack.
The examples are pulled from the examples/vanilla folder.
This is just a start, would like to add more and more examples.

The HTML is editable and for the themes one can also edit the theme in
place and open it up in Sandbox for keeping their own copy for example.

The goal is to show off more with the cool things that can be easily
build with media-chrome and to be easier discoverable.

https://media-chrome-docs-git-fork-luwes-docs-upgrade-mux.vercel.app/docs/en/examples

---

Upgrades the docs dependencies and Astro to v4.

Vite has a regression which is reported here
vitejs/vite#15702 which Astro runs into
together with the React Sandpack library. So I pinned it to vite 5.0.10
to get around that.

Sandpack has a regression which I submitted an issue for here:
codesandbox/sandpack#1068

The rest seemed to work, a few more warnings in the CLI when building.
luwes added a commit to muxinc/media-chrome that referenced this issue Feb 1, 2024
This change adds a docs examples page with Sandpack.
The examples are pulled from the examples/vanilla folder.
This is just a start, would like to add more and more examples.

The HTML is editable and for the themes one can also edit the theme in
place and open it up in Sandbox for keeping their own copy for example.

The goal is to show off more with the cool things that can be easily
build with media-chrome and to be easier discoverable.

https://media-chrome-docs-git-fork-luwes-docs-upgrade-mux.vercel.app/docs/en/examples

---

Upgrades the docs dependencies and Astro to v4.

Vite has a regression which is reported here
vitejs/vite#15702 which Astro runs into
together with the React Sandpack library. So I pinned it to vite 5.0.10
to get around that.

Sandpack has a regression which I submitted an issue for here:
codesandbox/sandpack#1068

The rest seemed to work, a few more warnings in the CLI when building.
@mavyfaby
Copy link

mavyfaby commented Feb 2, 2024

Any updates on this?

@christophe-g
Copy link

christophe-g commented Feb 2, 2024

I think I am facing the same issue.

Last working version for me is 5.0.10. Build fail under 5.0.11 and above (incl. beta).

Interestingly, a build that includes @vitejs/plugin-legacy plugin works even on 5.0.11 and above.

I have no sourcemap configuration set, but quite a lot of dynamic imports.

@davie-robertson
Copy link

I have the same issue 5.1.4

@christophe-g
Copy link

I think it was merged just after 5.1.4 release.

@davie-robertson
Copy link

Do you know when the next release will be?
I'm using npm at the moment so I can't get at the fix by using "vite": "github:vitejs/vite#main" in my package.json

@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants