4👍
i was with the same error when trying to import a json for my server.
needs an import assertion of type "json"
I resolve with this:
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const exemple = require('./data/exemple.json');
Use this with your json.file and the node will reconize the importation.
Another exemple:
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const swaggerDocs = require("./swagger.json");
- [Vuejs]-Nuxt loading progress bar loads multiple times
- [Vuejs]-How to bind the value separately returned from the component
Source:stackexchange.com