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

🐛 BUG: outDir that doesn't have package.json with node_modules fails

Open lukecollier opened this issue 3 years ago • 1 comments

What version of astro are you using?

1.0.0-beta.73

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

None

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

If we create a new project and use solid-js as the baseline then change the outDir in configuration to a relative path without a node modules, for example "../dist" an error is thrown that solid js cannot be found.

If we then cp package.json ./package.json && cd .. && yarn then try again the build completes successfully.

Full error:

error   Cannot find package 'solid-js' imported from /Users/lukecollier/Projects/mull.dev/docs/entry.mjs
    at new NodeError (node:internal/errors:372:5)
    at packageResolve (node:internal/modules/esm/resolve:954:9)
    at moduleResolve (node:internal/modules/esm/resolve:1003:20)
    at defaultResolve (node:internal/modules/esm/resolve:1218:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36)
error Command failed with exit code 1.

Funnily enough in stackblitz you can ctl + c in the console window to run yarn build and another error occurs in stack blitz un-related to this issue! (Something to do with go pipelines etc)

Link to Minimal Reproducible Example

https://stackblitz.com/edit/outdir-issue?file=astro.config.mjs

Participation

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

lukecollier avatar Jul 21 '22 12:07 lukecollier

@matthewp might know more about this. I think the problem is that we try to build our tmp files to the outDir, when they should probably stay inside your main repo.

natemoo-re avatar Jul 21 '22 21:07 natemoo-re