Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

importing json results in assertion error #15

Open
Kilian opened this issue Nov 11, 2022 · 0 comments
Open

importing json results in assertion error #15

Kilian opened this issue Nov 11, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Kilian
Copy link

Kilian commented Nov 11, 2022

Description

In my Remix entry files I import json:

import en from "javascript-time-ago/locale/en.json";

When running with remix-vite, this results in an error:

TypeError: Module "file:///projectfolder/node_modules/javascript-time-ago/locale/en.json" needs an import assertion of type "json"

So I add an assertion:

import en from "javascript-time-ago/locale/en.json" assert {type: "json"};

and that gives me a different error:

SyntaxError: projectfolder/app/entry.server.tsx: Support for the experimental syntax 'importAssertions' isn't currently enabled (10:53):

According to the vite docs, json shouldn't need an assertion: https://vitejs.dev/guide/features.html#json

Library version

0.2.2

Node version

v16.18.0

@Kilian Kilian added the bug Something isn't working label Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant