PepsRyuu / create-nollup-app

MIT License
6 stars 0 forks source link

Preact template doesn't work with pnpm #3

Open rhendric opened 3 years ago

rhendric commented 3 years ago

Out of the box, create-nollup-app --name test-app --template preact && cd test-app && pnpm i && pnpm start fails with

[Nollup] Listening on http://localhost:9001
ParseError: /src/@prefresh/core.js
Error: ENOENT: no such file or directory, open '.../test-app/src/@prefresh/core.js'
    at compileModule (.../test-app/node_modules/.pnpm/nollup@0.16.5_rollup@2.52.2/node_modules/nollup/lib/impl/NollupCompiler.js:200:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async compileInputTarget (.../test-app/node_modules/.pnpm/nollup@0.16.5_rollup@2.52.2/node_modules/nollup/lib/impl/NollupCompiler.js:231:5)
    at async Object.compile (.../test-app/node_modules/.pnpm/nollup@0.16.5_rollup@2.52.2/node_modules/nollup/lib/impl/NollupCompiler.js:302:31)
    at async generateImpl (.../test-app/node_modules/.pnpm/nollup@0.16.5_rollup@2.52.2/node_modules/nollup/lib/index.js:14:21)

Doesn't happen with the other templates, doesn't happen with npm. I'm evaluating switching to pnpm, so I'm not yet familiar enough with how it does things differently to offer a guess about why it breaks this, sorry!

rhendric commented 3 years ago

Aha, adding @prefresh/core to devDependencies fixes it.

PepsRyuu commented 3 years ago

That... doesn't seem right. @prefresh/core is a direct dependency of @prefresh/nollup. This might be a bug with pnpm? Seems weird that it isn't installing a dependency of a dependency.

PepsRyuu commented 3 years ago

It looks like .pnpm does some sort of strange flattening of dependencies? That's definitely going to cause problems. I'm not entirely sure how that's fixed though... Not an issue related to create-nollup-app though.

rhendric commented 3 years ago

The pnpm docs seem to indicate that this sort of thing usually happens because some package ought (in pnpm's opinion, I guess?) to have a dependency on another but doesn't. So maybe this is a Prefresh bug? But maybe the template should include @prefresh/core in the dependencies too? Honestly I don't know; I'm just feeling my way around here.