-
Notifications
You must be signed in to change notification settings - Fork 67
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Released in 1.0.20
@vadimkorr
vadimkorr
added
the
documentation
Improvements or additions to documentation
label
Sep 3, 2022
cloudlena
commented
Sep 3, 2022
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
but the resulting code seems to work fine