Skip to content
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

Import assertion error from Deno SaaSKit #17

Closed
barcellos-pedro opened this issue Oct 12, 2024 · 4 comments
Closed

Import assertion error from Deno SaaSKit #17

barcellos-pedro opened this issue Oct 12, 2024 · 4 comments

Comments

@barcellos-pedro
Copy link

I was about to start the denoland/saaskit project following the docs but then I came across this error.

The server doesn’t start when I run deno task start

I’m not sure how to resolve this.
I checked the docs and didn’t find any mentions.

$ deno task start
Task start deno run --unstable-kv -A --watch=static/,routes/ --env dev.ts
Watcher Process started.
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import emojis from "./all.json" assert { type: "json" };
at https://deno.land/x/[email protected]/emoji.ts:2:1
@eliassjogreen
Copy link
Member

See #16

@sebilasse
Copy link

Clarification :
The underlying issue is described here https://deno.com/blog/v2.0-release-candidate#import-assertions-are-dead-long-live-import-attributes

@eliassjogreen @marvinhagemeister I am using deno-gfm in my fresh project.
If I do use it locally with the denoland/deno-gfm#128 for emoji 3.1 then the build „works“ but the console shows this error „JSON does not support comments“ ...
Bildschirmfoto zu 2024-10-13 11-47-17

@eliassjogreen
Copy link
Member

eliassjogreen commented Oct 14, 2024

Heh, looks like we got our answer. Ignore my comment


That seems like a comment injected by JSR or the deno cache? The all.json simply contains the following:

$ curl https://jsr.io/@denosaurs/emoji/0.3.1/all.json | head
  {
    "group": "Smileys & Emotion",
    "subgroup": "face-smiling",
    "emoji": "😀",
    "emojiVersion": 1,
    "unicodeVersion": 8,
    "description": "grinning face",
    "tags": [

$ curl https://jsr.io/@denosaurs/emoji/0.3.1/all.json | tail
    "unicodeVersion": 10,
    "description": "flag: Wales",
    "tags": [
      "flag: Wales"
    ],
    "aliases": [
      "flag_wales"
    ]
  }
]

Have you tried running it with -r? Otherwise I suggest you open an issue in https://github.com/denoland/deno_cache_dir or https://github.com/denoland/deno where I suspect the issue originates.

@marvinhagemeister
Copy link

@sebilasse I've just released Fresh 1.7.3 which resolves that error. Deno 2 appends a comment with cache metadata to every file which makes it not valid JSON anymore. This comment needs to be stripped out in the esbuild deno loader again. Upgrade your Fresh version to resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants