-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Error while trying to bundle local workspace dependency #17902
Comments
Unless you have a reproduction without Astro (and current reproduction is far from minimal for Asto I believe), it's usually better to open an issue there first. If Astro maintainers think this is a Vite issue, then they can redirect you here and that's more efficient flow. Checking the reproduction, it looks like you didn't mention that the error is happening during pre-rendering:
After following stacktrace, it looks like server bundle includes I thought export default defineConfig({
...
adapter: node({
mode: 'standalone',
}),
vite: {
ssr: {
external: ["registry-tools"]
}
}
}); prerendering static routes
09:26:57 λ src/pages/registry/[type].json.ts
09:26:57 ├─ /registry/helpers.json (+4ms)
09:26:57 └─ /registry/snippets.json (+1ms)
09:26:57 λ src/pages/registry/[type]/[name].ts
09:26:57 ├─ /registry/helpers/alphabetical.json (+1ms)
09:26:57 ├─ /registry/helpers/alphabetical.ts (+1ms)
09:26:57 ├─ /registry/helpers/alphabetical.jsNo parser and no file path given, couldn't infer a parser.
Stack trace:
at normalizeFormatOptions (file:///home/hiroshi/code/tmp/vite-17902-cjs/node_modules/.pnpm/[email protected]/node_modules/prettier/index.mjs:20621:13) Actually, I see a same error from
So this issue might be simply your application's issue. Considering all this, it's hard to analyze it as a Vite issue, so I'd suggest opening an issue on Astro first and get some help there. |
Hey @hi-ogawa! Thanks for the prompt response – that makes sense, and it is puzzling to me why all of that stuff is getting bundled. I assumed it might be Vite because Vite handle's Astro's bundling, but you're right, it could also be an issue with the adapter I'm using or something Astro-specific. Will ask over there! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the bug
Hey folks,
I know bugs in a similar vein have been reported here before, but the supposed fixes are working for me – I have a PNPM monorepo and am trying to build my Astro project using Vite while depending on another workspace ESM package.
This other package has some CJS dependencies that aren't being transformed by Vite during compilation.
Notably, I keep receiving the error:
Reproduction
https://github.com/Nickersoft/code-snippets/tree/nickersoft/build-bug
Steps to reproduce
You can reproduce it via my source repo. Just clone it, run
pnpm install
in the root, thencd
into thewww
directory and runpnpm run build
. The error occurs while bundling the Astro website using a Vercel adapter. If this ends up being an Astro issue, happy to open an issue over there, though I have a hunch it's Vite.System Info
Used Package Manager
pnpm
Logs
__filename is not defined in ES module scope
Stack trace:
at isFileSystemCaseSensitive (file:///Users/tjnickerson/Documents/GitHub/Nickersoft/code-snippets/www/.vercel/output/_functions/chunks/snippets_Dkrq05sR.mjs:8647:36)
at file:///Users/tjnickerson/Documents/GitHub/Nickersoft/code-snippets/www/.vercel/output/_functions/chunks/snippets_Dkrq05sR.mjs:8856:13
at file:///Users/tjnickerson/Documents/GitHub/Nickersoft/code-snippets/www/.vercel/output/functions/chunks/snippets_Dkrq05sR.mjs:192449:4
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async BuildPipeline.retrieveSsrEntry (file:///Users/tjnickerson/Documents/GitHub/Nickersoft/code-snippets/node_modules/.pnpm/[email protected]@types[email protected][email protected][email protected]/node_modules/astro/dist/core/build/pipeline.js:237:15)
Validations
The text was updated successfully, but these errors were encountered: