svench icon indicating copy to clipboard operation
svench copied to clipboard

Fresh install fails with rollup message

Open yanick opened this issue 4 years ago • 7 comments

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/@[email protected][email protected]/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 avatar Sep 04 '21 17:09 yanick

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

yanick avatar Sep 06 '21 20:09 yanick

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/[email protected].

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

rixo avatar Sep 12 '21 21:09 rixo

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! ;-)

yanick avatar Sep 12 '21 23:09 yanick

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?

rixo avatar Sep 15 '21 20:09 rixo

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... 

yanick avatar Sep 19 '21 15:09 yanick

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?

rixo avatar Sep 20 '21 06:09 rixo

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....

yanick avatar Sep 20 '21 12:09 yanick