rixo / svench

A lightweight workbench to develop your Svelte components in isolation
svench-docs.vercel.app
208 stars 6 forks source link

Fresh install fails with rollup message #42

Open yanick opened 3 years ago

yanick commented 3 years ago

From an empty state:

⥼ pnpm add -D svelte vite @sveltejs/vite-plugin-svelte svench
Packages: +138

devDependencies:
+ @sveltejs/vite-plugin-svelte 1.0.0-next.21
+ svelte 3.42.4
+ svench 0.2.0-30
+ vite 2.5.3

(note I'm using @sveltejs/vite-plugin-svelte instead of @svitejs/vite-plugin-svelte. Using the latter causes a "createPlugin is not a function error" earlier in the game)

and then

⥼ echo '<h1>Hi!</h1>' > src/Hi.svench

⥼ svench
[svench] Compiling Svench 0.2.0-30 runtime with Svelte 3.42.4 (dev)...
[svench] Compiled Svench runtime in 13.36s
1:04:32 p.m. [vite] page reload index.html
Pre-bundling dependencies:
  svelte/animate
  svelte/easing
  svelte/internal
  svelte/motion
  svelte/store
  (...and 32 more)
(this will be run only when your dependencies or config have changed)
 > node_modules/.pnpm/@rollup+pluginutils@3.1.0_rollup@2.56.3/node_modules/@rollup/pluginutils/dist/es/index.js:1:9: error: No matching export in "browser-external:path" for import "extname"
    1 │ import { extname, sep, resolve, posix } from 'path';
      ╵          ~~~~~~~
<snip more of the same>
yanick commented 3 years ago

Fwiw I have things running with svench up to v0.2.0-17.

rixo commented 3 years ago

I think that's due to recent changes of strategy for automating Vite's optimizeDeps, in @sveltejs/vite-plugin-svelte (and yes, indeed, that's the plugin to use now; the @svitejs one is not supported anymore... should probably update Svench's docs, somewhere?).

The core of the problem is apparently that Vite is now trying to absorb dependencies that are only used in Node code in Svench...

Apparently, the last version of the plugin that worked with Svench is @sveltejs/vite-plugin-svelte@1.0.0-next.19.

I'm studying how Svench should be modified to support the last versions of the plugin.

yanick commented 3 years ago

I think that's due to recent changes of strategy for automating Vite's optimizeDeps, in @sveltejs/vite-plugin-svelte (and yes, indeed, that's the plugin to use now; the @svitejs one is not supported anymore... should probably update Svench's docs, somewhere?).

It's mentioned in the main README.md. I'll try to submit a PR next time I'm around that file. :-)

The core of the problem is apparently that Vite is now trying to absorb dependencies that are only used in Node code in Svench...

Yup. I have to say, Vite is awesome. And Vite -- and ESM imports -- is also a huge pain for a lot of things.

I'm studying how Svench should be modified to support the last versions of the plugin.

Fingers crossed for a speedy "ah AH!" eureka.

Meanwhile, have you seen that Storybook now offers much better Svelte support? The competition is getting fierce! ;-)

rixo commented 3 years ago

This should be fixed in 0.2.0-31. Can you confirm?

Meanwhile, have you seen that Storybook now offers much better Svelte support? The competition is getting fierce! ;-)

Are they fast yet?

yanick commented 3 years ago

I've upgraded to -31. I don't get the original error (yay!), but if I try to access the svench main page (localhost:4242), I get a blank page and the console error:


Uncaught DOMException: The quota has been exceeded. app-0.2.0-31_3.42.6_dev.js:13
    <anonymous> http://localhost:4242/@fs/home/yanick/work/javascript/space-hulk/node_modules/svench/runtime/app-0.2.0-31_3.42.6_dev.js:13
    InnerModuleEvaluation self-hosted:2381
    InnerModuleEvaluation self-hosted:2381
    evaluation self-hosted:2332

​```

[Storybook] Are they fast yet?

By default, nope, not yet. :-) But there is a Vite plugin in the works, and with that the starting time shrinks by a *lot*. So they are getting there... Still behind Svench, but they are picking up... 
rixo commented 3 years ago

Quota exceeded? This is a localStorage error, isn't it? Svench doesn't put so much in localStorage :thinking:

Do you get that on any browser? Or what browser?

yanick commented 3 years ago

On Mon, 20 Sep 2021, at 2:52 AM, rixo wrote:

Quota exceeded? This is a localStorage error, isn't it? Svench doesn't put so much in localStorage 🤔

Do you get that on any browser? Or what browser?

I only get that in Firefox (on Linux). Now that you said that, I've also tried chrome and... Svench works there.

For what it's worth, looking at the local storage tab of Firefox's devtool, there is nothing stored for localhost:4242. And I did a hard reset of the cache (plus a rm -fr node_modules/.vite) to take that out of the equation too. Still see the error.

Weeeeeeeird....