Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

make sveltekit look more idiomatic #114

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

Merged
vadimkorr merged 1 commit into vadimkorr:main from oetiker:patch-1
Sep 3, 2022
Merged

Conversation

Copy link
Contributor

@oetiker oetiker commented Jun 27, 2022

Using the $app/env we can make this look much more idiomatic. While still ensuring the code only runs in the browser.

The compiler is not entirely happy as it still complains:

svelte-carousel doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

but the resulting code seems to work fine

JulianRojasBet reacted with eyes emoji
Using the `$app/env` we can make this look much more idiomatic. While still ensuring the code only runs in the browser.
The compiler is not entirely happy as it still complains:
```
svelte-carousel doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.
```
but the resulting code seems to work fine
@vadimkorr vadimkorr merged commit 144d170 into vadimkorr:main Sep 3, 2022
Copy link
Owner

Released in 1.0.20

@vadimkorr vadimkorr added the documentation Improvements or additions to documentation label Sep 3, 2022
Copy link

For me, this doesn't work... I'm getting the following error:

Cannot use import statement outside a module
/home/lena/bespinian/bespinian.io-svelte/node_modules/svelte-carousel/src/main.js:1
import Carousel from './components/Carousel/Carousel.svelte'
^^^^^^
SyntaxError: Cannot use import statement outside a module
 at Object.compileFunction (node:vm:360:18)
 at wrapSafe (node:internal/modules/cjs/loader:1048:15)
 at Module._compile (node:internal/modules/cjs/loader:1083:27)
 at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
 at Module.load (node:internal/modules/cjs/loader:997:32)
 at Module._load (node:internal/modules/cjs/loader:838:12)
 at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
 at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
 at async Promise.all (index 0)
 at async ESMLoader.import (node:internal/modules/esm/loader:528:24)

Furthermore, $app/env was renamed to $app/environment in @sveltejs/kit@1.0.0-next.445: https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md#100-next445 so the example given in the readme is not correct anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

documentation Improvements or additions to documentation

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /