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
% node -r tsconfig-paths/register src/config.ts
(node:47864) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/laurence.fass/SSG/events-service-ui/src/config.ts:2
import {
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47
stage 2:
I added type: "module" to package.json
% node -r tsconfig-paths/register src/config.ts
node:internal/errors:464
ErrorCaptureStackTrace(err);
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/laurence.fass/SSG/events-service-ui/src/config.ts
at new NodeError (node:internal/errors:371:5)
at Loader.defaultGetFormat [as _getFormat] (node:internal/modules/esm/get_format:71:15)
at Loader.getFormat (node:internal/modules/esm/loader:105:42)
at Loader.getModuleJob (node:internal/modules/esm/loader:243:31)
at async Loader.import (node:internal/modules/esm/loader:177:17)
at async Object.loadESM (node:internal/process/esm_loader:68:5)
at async handleMainPromise (node:internal/modules/run_main:63:12) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Really no idea where to go from here so any help and advice appreciated.
The text was updated successfully, but these errors were encountered:
I dont have a main.js file.
My root file is src/config.ts.
I am trying to use this in parcel app.
stage 1 (following docs).
stage 2:
I added type: "module" to package.json
Really no idea where to go from here so any help and advice appreciated.
The text was updated successfully, but these errors were encountered: