lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

🐛 BUG: nested `astro.config` files cause dev server errors

Open Enteleform opened this issue 3 years ago • 2 comments

What version of astro are you using?

1.0.0-beta.24

Are you using an SSR adapter? If so, which one?

No

What package manager are you using?

Yarn

What operating system are you using?

Windows

Describe the Bug

Just ran into this error when running the dev server on a project that contains a nested astro.config file.

Error: Build failed with 5 errors:
node_modules/svelte-preprocess/dist/modules/language.js:27:24: ERROR: Could not resolve "sugarss"
node_modules/svelte-preprocess/dist/transformers/coffeescript.js:7:47: ERROR: Could not resolve "coffeescript"
node_modules/svelte-preprocess/dist/transformers/less.js:8:39: ERROR: Could not resolve "less"
node_modules/svelte-preprocess/dist/transformers/pug.js:8:38: ERROR: Could not resolve "pug"
node_modules/svelte-preprocess/dist/transformers/stylus.js:8:41: ERROR: Could not resolve "stylus"
  at failureErrorWithLog (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:1557:15)
  at eval (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:1215:28)
  at runOnEndCallbacks (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:1005:63)
  at buildResponseToResult (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:1213:7)
  at eval (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:1322:14)
  at eval (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:637:9)
  at handleIncomingPacket (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:734:9)
  at Socket.readFromStdout (/home/projects/github-qrvb6k-se32e8/node_modules/esbuild/lib/main.js:604:7)
  at Socket.EventEmitter.emit (https://github-qrvb6k-se32e8.w.staticblitz.com/blitz.331c80ffab288536319518a60349d00207075dad.js:6:155505)
  at addChunk (https://github-qrvb6k-se32e8.w.staticblitz.com/blitz.331c80ffab288536319518a60349d00207075dad.js:6:656340)

Use Case

  • I'm writing a ComponentSandbox component
  • I want to include template files to be sent to Stackblitz in /src/
    • for example: /src/Templates/Foo/astro.config.ts

https://user-images.githubusercontent.com/10906415/166838165-b745e4e8-3201-4d5f-ac98-9ef8a681a586.mp4

Steps To Reproduce

  • fork the Kitchen Sink (Multiple Frameworks) example from astro.new
  • copy ./astro.config.mjs to ./src/templates/StackBlitz/astro.config.mjs

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-qrvb6k-se32e8

Participation

  • [ ] I am willing to submit a pull request for this issue.

Enteleform avatar May 04 '22 22:05 Enteleform

So this looks like an issue coming from vite-plugin-svelte? I think what's happening is it's trying to preprocess everything inside of the src/ directory.

Is there a reason your templates need to be inside of src/? Do all of these templates need to be built?

natemoo-re avatar May 10 '22 18:05 natemoo-re

So this looks like an issue coming from vite-plugin-svelte? I think what's happening is it's trying to preprocess everything inside of the src/ directory.

Is there a reason your templates need to be inside of src/? Do all of these templates need to be built?

Putting the templates @ the project root seems to work as a workaround, just thought it was a weird issue and am wondering if other valid source code could cause the same type of issue.

Enteleform avatar May 11 '22 23:05 Enteleform