Oli8 / spaper

PaperCSS components for Svelte
https://oli8.github.io/spaper/
MIT License
199 stars 9 forks source link

SvelteKit Updates #4

Closed theClarkSell closed 2 years ago

theClarkSell commented 2 years ago

Ran across this recently and went to play with it. Love it, thank you for the hard work.

I believe some work needs to be done to work out of the box for SvelteKit. Upon running you will get this error

1:47:54 PM [vite] Error when evaluating SSR module /node_modules/lodash.omit/index.js?v=ded03013:
ReferenceError: module is not defined
    at /node_modules/lodash.omit/index.js?v=ded03013:1488:1
    at instantiateModule (/Users/clarksell/source/scratch/KitNow/node_modules/vite/dist/node/chunks/dep-85dbaaa7.js:66541:15)

You can resolve it by adding this to your svelte.config.js file but I think it really needs to be converted to a module.

  vite: {
    optimizeDeps: {
      include: ['lodash.omit', 'lodash.pick']
      }
    }

I didn't have a chance to look through the source yet but I wanted to drop this here for others.

Oli8 commented 2 years ago

Hey, thanks for the kind words and the suggestion, I'll look that up soon ! :)

jdgamble555 commented 2 years ago

I had the same problem, @csell5 that did not fix it. @Oli8 - Agreed. Beautiful UI. Can't wait to use it!

jdgamble555 commented 2 years ago

I am getting a new error in SvelteKit:

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'C:\web projects\my-project\node_modules\spaper\components\Modal' is not supported resolving ES modules imported from C:\web projects\my-project\node_modules\spaper\index.js
    at new NodeError (internal/errors.js:322:7)
    at finalizeResolution (internal/modules/esm/resolve.js:304:17)
    at moduleResolve (internal/modules/esm/resolve.js:731:10)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:842:11)
    at Loader.resolve (internal/modules/esm/loader.js:89:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
    at link (internal/modules/esm/module_job.js:75:36)

with the simple lines:

import { Navbar, Card } from 'spaper';

The older version worked.

J

AidanG1 commented 2 years ago

I am getting the same issue with Modal imports when not using the modal.

divStar commented 2 years ago

I am getting the same issue as well when using e.g. <Button>.

13:28:39 [vite] Error when evaluating SSR module /src/routes/index.svelte:
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'C:\workspaces\web\gtg-svelte\node_modules\spaper\components\Modal' is not supported resolving ES modules imported from C:\workspaces\web\gtg-svelte\node_m
odules\spaper\index.js
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:412:17)
    at moduleResolve (node:internal/modules/esm/resolve:932:10)
    at defaultResolve (node:internal/modules/esm/resolve:1044:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36)
Oli8 commented 2 years ago

As of v0.2.6 lodash omit and pick are no longer required. Component imports should work fine.