Skip to content

fix(build): add workaround for building on stackblitz - #22840

Merged
sapphi-red merged 2 commits into
mainfrom
fix/build-on-stackblitz
Jul 9, 2026
Merged

sapphi-red merged 2 commits into
mainfrom
fix/build-on-stackblitz

Conversation

@sapphi-red

Copy link
Copy Markdown
Member

When building on stackblitz, the import.meta.resolve in the output was replaced with a slightly different value (𝐢𝐦𝐩𝐨𝐫𝐭.meta.resolve).
https://stackblitz.com/edit/vitejs-vite-yuazbcvz?file=index.html&terminal=build
This causes ReferenceError: 𝐢𝐦𝐩𝐨𝐫𝐭 is not defined error.

This is caused by how stackblitz works and the way we use function.toString(): https://stackblitz.com/edit/node-vqfvv8dy?file=index.js

This PR adds a workaround for that.

@sapphi-red sapphi-red added p3-minor-bug An edge case that only affects very specific usage (priority) feat: build labels Jul 2, 2026
@pkg-pr-new

ghost commented Jul 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/plugin-legacy

pnpm add https://pkg.pr.new/@vitejs/plugin-legacy@22840 -D
npm i https://pkg.pr.new/@vitejs/plugin-legacy@22840 -D
yarn add https://pkg.pr.new/@vitejs/plugin-legacy@22840.tgz -D

vite

pnpm add https://pkg.pr.new/vite@22840 -D
npm i https://pkg.pr.new/vite@22840 -D
yarn add https://pkg.pr.new/vite@22840.tgz -D

commit: 348af93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: build p3-minor-bug An edge case that only affects very specific usage (priority) trigger: preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant