Apify and Crawlee Official Forum

Updated 4 months ago

Any relative imported files throws error in Crawlee

{
"extends": "@apify/tsconfig",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ES2022",
"outDir": "dist",
"noUnusedLocals": false,
"skipLibCheck": true,
"lib": ["DOM"]
},
"include": ["./src/*/", "scripts"]
}


Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../../types.js'?

any files that is imported throws an error when building. For instance, in my main.ts file if there is a constants.ts file in the same dir,
import const from './contants
throws an error in build and in typescript warning in IDE

Is there something I can do to make my builds work again? Thanks
G
1 comment
I figured it out, had to add .js to all the imports.. even tho they are .ts files
Add a reply
Sign up and join the conversation on Discord