Importing a file outside of the project folder causes: Emit skipped error
Im trying to import a file outside of the project. It's a shared file between the frontend and the server.
When i try import it it throws this error:
node_modules/ts-node/src/index.ts:370
throw new TypeError(`${relative(cwd, fileName)}: Emit skipped`)
^
TypeError: project/my_file.ts: Emit skipped
at getOutput (/Users/.../node_modules/ts-node/src/index.ts:370:15)
at Object.compile (/Users/.../node_modules/ts-node/src/index.ts:558:11)
at Module.m._compile (/Users/.../node_modules/ts-node/src/index.ts:439:43)
at Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/.../node_modules/ts-node/src/index.ts:442:12)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
I'm able to import it from my angular project which is a sibling.
I've tried adding the file to my tsconfig under includes and files. This is what my tsconfig looks like:
{ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../../dist/backend", "rootDir": "./", "module": "commonjs", "types": [ "node" ] }, "files": [ "../lib/shared_file_to_import.ts" // Can't import this file ], "include": [ "./**/*.ts" ] }
And this is my tsconfig file that the project extends:
{ "compileOnSave": false, "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "baseUrl": "./", "rootDir": ".", "outDir": "./dist", "sourceMap": true, "strict": true, "strictPropertyInitialization": false, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": true, "target": "es5", "strictNullChecks": true, "typeRoots": [ "node_modules/@types" ], "lib": [ "es2017", "dom" ] }, "include": [ "./lib/shared_file_to_import.ts" ] }