You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried replacing ts-node with tsimp in a Node.js server project.
Upon running node --import=tsimp/import src/index.js, I was met with the following error:
/server/src/index.js:2
import myJsonFile from '../data/test_json_file.json' assert { type: 'json' };
^
SyntaxError: The requested module '../data/test_json_file.json' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:213:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:66:12)
Node.js v20.9.0
This obviously works when using ts-node.
I have also tried using new with instead of assert, but this didn't do the trick either.
The text was updated successfully, but these errors were encountered:
wojtekmaj
changed the title
SyntaxError: Named export 'rimraf' not found.
The requested module '../data/test_json_file.json' does not provide an export named 'default'
Nov 28, 2023
I tried replacing ts-node with tsimp in a Node.js server project.
Upon running
node --import=tsimp/import src/index.js
, I was met with the following error:This obviously works when using ts-node.
I have also tried using new
with
instead ofassert
, but this didn't do the trick either.tsconfig.json
:The text was updated successfully, but these errors were encountered: