compiler icon indicating copy to clipboard operation
compiler copied to clipboard

🐛 BUG: Transform couldn't find `astro/internal`

Open yanthomasdev opened this issue 2 years ago • 2 comments

What version of @astrojs/compiler are you using?

0.14.2

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the Bug

When using the transform method imported from @astrojs/compiler, I get this error, saying that astro/internal couldn't be found:

Cannot find module 'astro/internal' imported from '/home/projects/github-dm6xxp-hnfnvq/src/pages/index.astro'
Error: Cannot find module 'astro/internal' imported from '/home/projects/github-dm6xxp-hnfnvq/src/pages/index.astro'
    at viteResolve (/home/projects/github-dm6xxp-hnfnvq/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:59357:25)
    at nodeImport (/home/projects/github-dm6xxp-hnfnvq/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:59392:15)
    at ssrImport (/home/projects/github-dm6xxp-hnfnvq/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:59288:20)
    at eval (/home/projects/github-…

Note:

  • Changing internalURL to the absolute path makes a new error appear:
failed to load module for ssr: ../astro/internal
Error: failed to load module for ssr: ../astro/internal
    at instantiateModule (/home/projects/github-dm6xxp-hnfnvq/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:59253:15)

I tried adding astro to vite.ssr.external and vite.optimizeDeps.exclude (via updateConfig or as part of the original astro.config.mjs file) but the issue persists.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-dm6xxp-hnfnvq?file=packages%2Fplugin.js,astro.config.mjs

yanthomasdev avatar May 23 '22 19:05 yanthomasdev

@Yan-Thomas have you found a solution for this?

armedi avatar Jul 03 '22 07:07 armedi

Unfortunately no, @armedi

yanthomasdev avatar Jul 03 '22 10:07 yanthomasdev

Sorry for the super long delay on this! astro/internal used to be how we referenced our server runtime but it was moved to astro/runtime/server/index.js. I'm going to update our defaults.

natemoo-re avatar Nov 16 '22 14:11 natemoo-re