-
Notifications
You must be signed in to change notification settings - Fork 75
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
Crank not installing correctly on Snowpack 2 #99
Comments
I filed https://www.pika.dev/npm/snowpack/discuss/151 on this; it's arguably Snowpack's fault. |
Does this bug have a github issue or do I have to use pikapkg discussions 😅 |
You have to use pikapkg. Also, I was poking at this recently and this bug is wayyyy out of date. Snowpack 2 has churned a lot in the last week and a half; my repro no longer works; my workaround no longer works. |
https://www.pika.dev/npm/snowpack/discuss/185 (so of course it fails with |
Here's an updated repro script. It doesn't work, and I can't figure out how to make it work.
Here's the error I get:
Changing the import to |
If they’re changing stuff rapidly, I guess this could go in a later release when they figure it out. Not worth doing rollup hacks to figure it out today. |
FWIW, I think the core issue on their end is still https://www.pika.dev/npm/snowpack/discuss/151 "Snowpack 2: Can't import subpackages" But I am able to successfully import |
preactjs/preact@7d708e8 Just found this, maybe it’s relevant? What on Earth is up with the exports map? It feels like such a scary and dangerous configuration option. |
What does |
I think the current iteration of Snowpack doesn't attempt to consume |
Yeah, I had it right. https://github.com/pikapkg/snowpack/blob/master/src/util.ts#L71 Fixing https://www.pika.dev/npm/snowpack/discuss/151 would require a PR to fix "resolveDependencyManifest" to handle subpackages |
FWIW it seems like some of the fixes mentioned above have been merged and are available in the latest version of snowpack (2.9.0 as of this comment). snowpack's module-discovery tool still doesn't find scoped packages, so I had to manually add |
I have a Snowpack template here which I’m experimenting with. No testing or hot reloading yet, but it seems to work fine. Hot reloading should probably go in its own issue. My idea for how it should work is that we keep a global cache of function definitions by module and only redefine functions when their definitions change. I haven’t really been able to learn anything by reading the sources of the hot-reloading stuff by other frameworks; they very much feel like Rube Goldberg machines in terms of complexity. One limitation of Crank is that we don’t have any knowledge of the internal state of generator components, so we won’t be able to preserve the state of a component which is redefined. I don’t mind this limitation, personally, but YMMV. Snowpack feels like the best in class of the current bundlers, but I’m still unhappy with all bundlers for the config file-based all-in-one builds plus dev server architectures they use. I’ve been working on a prototype bundler alternative but I’ve put it on pause because my dissatisfaction goes down to the level of runtimes (both Node and Deno are annoying me at this point). |
I managed to get Babel/JSX working on Snowpack, with a number of bug workarounds.
Here are the Snowpack bugs:
"build:"
step or it refuses to build anything. (Fix merged but not yet released)"@snowpack/plugin-babel"
and not just"babel"
(Documentation fix merged but not yet deployed).jsx
; Snowpack fails with a parse error if you put it in a.js
file. (Documentation fix merged but not yet deployed)With that done, I was able to convince Snowpack to work only when I imported a full path to the ESM js file, e.g.
import {renderer} from '@bikeshaving/crank/esm/dom.js';
I couldn't get it to work with
import {renderer} from '@bikeshaving/crank/dom'
, even in my PR branch for #88. Snowpack assumes that subpackages have their ownpackage.json
file. It gave up when it couldn't find@bikeshaving/crank/dom/package.json
.The conclusion I draw from this is that Crank would need to provide a
dom/package.json
and perhapshtml/package.json
to satisfy Snowpack. I guess you could argue that this is a bug in Snowpack, but I bet they won't fix it, because other frameworks with subpackages do providepackage.json
files for their subpackages, e.g.preact/hooks
providespreact/hooks/package.json
.Repro script:
The text was updated successfully, but these errors were encountered: