Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing a file outside of the project folder causes: Emit skipped error #693

Closed
DustinJSilk opened this issue Sep 24, 2018 · 41 comments · Fixed by #1629
Closed

Importing a file outside of the project folder causes: Emit skipped error #693

DustinJSilk opened this issue Sep 24, 2018 · 41 comments · Fixed by #1629
Labels
Milestone

Comments

@DustinJSilk
Copy link

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"
  ]
}
@blakeembrey
Copy link
Member

@DustinJSilk Do you have an example that could be referenced? Also, what version of ts-node and arguments are you using?

@DustinJSilk
Copy link
Author

I was using version 7.0.1, with typescript 2.9.2 and without any arguments so it would have been default.

I can upload an example tomorrow evening and will send you a link. I switched to compiling down with just tsc in the meantime and dont have a branch with the original ts-node setup at the moment

@blakeembrey blakeembrey added the bug label Oct 7, 2018
@bennycode
Copy link

I got the "Emit skipped" error when trying to compile TypeScript code which was not under the 'rootDir' (tsconfig.json).

@blakeembrey
Copy link
Member

@bennyn Thanks for following up! Can you include the version (ts-node and typescript), your tsconfig.json and the file your tried importing? Does this compile with tsc?

@bennycode
Copy link

@blakeembrey I have used the latest and greatest:

  • typescript v3.3.3
  • ts-node v8.0.2
  • mocha v5.2.0

My tsconfig.json looks like this:

{
  "compilerOptions": {
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "dist",
    "rootDir": "src",
    "target": "es5"
  },
  "exclude": [
    "dist",
    "node_modules"
  ]
}

I tried to use ts-node for my mocha tests which were located in ./test but my rootDir was set to ./src so the following command failed with the message "Emit skipped":

mocha --bail --require ts-node/register --reporter spec test/main/**/*.ts

I have to admit that the error message sounded a little cryptic to me so I tried to run tsc and tsc failed too and gave me the hint that some of my TS files (the test code) is not in my rootDir, so I moved my tests from ./test to ./src/test and adjusted my mocha script:

mocha --bail --require ts-node/register --reporter spec src/test/main/**/*.ts

Now everything works like expected. 😃

@rosskevin
Copy link

From experimentation this appears to be happening when using ts-node --files with rootDir. I suspect related to the explanation here microsoft/TypeScript#9858

@Robert-Baindourov
Copy link

I am getting this same error within my project.
I don't even have a 'rootDir' in my tsconfig.json file

{
    "compilerOptions": {
        "allowJs": true,
        "target": "es2015",
        "moduleResolution": "node",
        "allowSyntheticDefaultImports": true,
        "module": "es2015",
        "sourceMap": false,
        "listEmittedFiles": true,
        "alwaysStrict": true,
        "esModuleInterop": true,
        "resolveJsonModule": true,
        "skipLibCheck": true
    },
    "include": [
        "lib/**/*",
        "bin/*",
        "tests/*.test.*"
    ],
    "exclude": [
        "node_modules",
    ]
}

Simply tried to do a

USWHBML00208269:umgc_node_api baindor$ node --experimental-modules -r esm -r ts-node/register ./bin/launch.ts

/Users/baindor/projects/umgc_node_api/node_modules/ts-node/src/index.ts:365
        throw new TypeError(`${relative(cwd, fileName)}: Emit skipped`)
              ^
/Users/baindor/projects/umgc_node_api/node_modules/ts-node/src/index.ts:1
TypeError: lib/HealthChecks/LinkHealthCheck.js: Emit skipped
    at getOutput (/Users/baindor/projects/umgc_node_api/node_modules/ts-node/src/index.ts:365:15)
    at Object.compile (/Users/baindor/projects/umgc_node_api/node_modules/ts-node/src/index.ts:395:32)
    at Object.m._compile (/Users/baindor/projects/umgc_node_api/node_modules/ts-node/src/index.ts:473:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Object.require.extensions.<computed> [as .js] (/Users/baindor/projects/umgc_node_api/node_modules/ts-node/src/index.ts:476:12)

It's strange because we have this working with esnext as the compile target and module target and then using gulp and babel as such:

gulp && pm2-runtime start --node-args='--experimental-modules --use_strict --no-warnings --require=@babel/register' bin/launch.js

But I want to skip the gulp step, and babel altogether and compile directly down to es2015 from typescript.

@Robert-Baindourov
Copy link

I found a combination that worked for me, something about allowJs broke it:
tsconfig.json

{
    "compilerOptions": {
        "allowJs": false,
        "target": "ES6",
        "moduleResolution": "node",
        "allowSyntheticDefaultImports": true,
        "module": "commonjs",
        "sourceMap": false,
        "listEmittedFiles": true,
        "alwaysStrict": true,
        "esModuleInterop": true,
        "resolveJsonModule": true,
        "skipLibCheck": true
    },
    "include": [
        "lib/**/*",
        "bin/*",
        "tests/*.test.*"
    ],
    "exclude": [
        "node_modules",
    ]
}

@vongohren
Copy link

vongohren commented Aug 22, 2019

Im getting this error when I just try to add typeRoots because of this issue: #745

I add
"typeRoots": ["./src/types","../../node_modules/@types"]

I have this tsconfig:

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "./dist",
    "moduleResolution": "node",
    "jsx": "react",
    "esModuleInterop": true,
    "typeRoots": ["./src/types","../../node_modules/@types"]
  },
  "include": [
    "./src"
  ],
  "exclude": [
    "../../node_modules", "node_modules"
  ],
}

and this as root

{
  "compilerOptions": {
      "allowJs": true,
      "module": "commonjs",
      "target": "ES2017",
      "sourceMap": true,
      "strict": true,
      "noFallthroughCasesInSwitch": true,
      "noImplicitReturns": true,
      "noEmitOnError": true
  },
  "exclude": [
      "node_modules"
  ]
}

@ncoder
Copy link

ncoder commented Jan 16, 2020

FYI: just in case this is useful some someone. using mocha + typescript + node, I received the same error, and it was because I had a .js file that got written next to the source .ts file. Presumably, even though ts-node isn't writing the .js files out, it detected that one was there and stopped.

@jordanrastrick
Copy link

Also leaving a comment in case it is useful to someone: this error can also occur if you have "allowJs": true and have a stray *.js file that corresponds to a *.ts file in your project.

@bluelovers
Copy link
Contributor

i get Emit skipped error when "allowJs": true is true too

https://github.com/bluelovers/is-req-https

@marchand-software
Copy link

Also leaving a comment in case it is useful to someone: this error can also occur if you have "allowJs": true and have a stray *.js file that corresponds to a *.ts file in your project.

Any solution to this other than turning off allowJs? Would like to compile both versions (.ts & .js) and use each where appropriate. Migrating from JavaScript to TypeScript...

@cspotcode
Copy link
Collaborator

Also leaving a comment in case it is useful to someone: this error can also occur if you have "allowJs": true and have a stray *.js file that corresponds to a *.ts file in your project.

Any solution to this other than turning off allowJs? Would like to compile both versions (.ts & .js) and use each where appropriate. Migrating from JavaScript to TypeScript...

@marchand-software Are you saying you have two files with exactly the same filename except for the file extension? For example, foo.js and foo.ts? That's what the comment was referring to.

@marchand-software
Copy link

@cspotcode yes, correct. It seems easiest for my project structure to duplicate the .js file and convert it to .ts but leaving the .js file for all other existing .js files that require it.

Essentially what I'm trying to do is work backwards on my dependency graph and eventually be able to delete all the .js files

@cspotcode
Copy link
Collaborator

@marchand-software are all your require statements including file extensions? Are you doing require('./foo.js') instead of require('./foo')? If so, why is the extension needed?

@marchand-software
Copy link

@cspotcode correct again. Well, kind of... I was mistakenly using a mix of both ways you mentioned... I tried changing all require('./foo.js') to require('./foo') given the nature of your comment.

Still getting the same Emit skipped error.

@cspotcode
Copy link
Collaborator

cspotcode commented Apr 15, 2020

@marchand-software If you change to require('./foo') then everything can load the .ts file. So you can delete the .js file.

@marchand-software
Copy link

marchand-software commented Apr 15, 2020

@cspotcode nailed it. Thanks a bunch. I was mislead into thinking .js files couldn't require/import .ts files...

@dandv
Copy link

dandv commented Jun 13, 2020

I have a similar problem while trying to import a .json file without resolveJsonModule: true in tscofig.json. I'm using this setup to be able to import JSON files from outside he rootDir. It works fine with tsc, and if I add resolveJsonModule: true in tsconfig.json, it fails with '../lib/settings.json' is not under 'rootDir'. So resolveJsonModule: true must not be in tsconfig.json.

When I run ts-node on a file that depends on settings.json, I get this error from ts-node:

TSError: ⨯ Unable to compile TypeScript:
src/modules/MyModule.ts(21,27): error TS2732: Cannot find module '../../../lib/settings.json'. Consider using '--resolveJsonModule' to import module with '.json' extension

@warent
Copy link

warent commented Jul 16, 2020

Nice one @bennyn, that was my problem

@tanekim88
Copy link

tanekim88 commented Oct 6, 2020

require('path without extension') does not work for Webpack, because webpack requires setting rules for each extensions. For example, .ts => handled by ts-loader, anything else is handled by raw loader.
So, if I do require('path without extension'), then it will go to raw loader to be handled.
Path with extension still need to be supported by 'require' in order for it to work properly in webpack.

@Copystrike
Copy link

Copystrike commented Oct 25, 2020

As this issue is still open I would like to share my piece. Reading this discussion I found this comment with a lot of likes; #693 (comment) which also solved my problem.

How did it happen?

I found that I once compiled my project without specifying an outdir that resulted in every TS file being compiled to JS files in the same path, next time I ran the project the throw a new TypeError('${relative(cwd, fileName)}: Emit skipped').

Solution

Delete every JS file with the same name in the same directory as the TS file, add 'outDir': "Some/path" in your tsconfig.json and you are safe.
PS: I experienced Webstorm collapse the JS files in the TS file (If they are called the same) in the IDE, you will have to use the explore to delete the JS or expand every TS file.

Don't

Do not do allowJs: false to solve this issue, this will literally ignore the TS files and use the compiled JS files, meaning next time you change something in the TS files it won't use the TS files but the old compiled JS files.


Conclusion

It would be awesome if it was possible to add a error message that explained this issue so people don't have to face this issue since it can be annoying, for use those people that have allowJs: false as default because they won't notice anything besides that their TS projects are not using the latest changes unless they compile every time they change something.

@GYuriy
Copy link

GYuriy commented Jan 25, 2021

I know we have "thumbs up" for this, but thank you @jordanrastrick !

@hyoretsu
Copy link

hyoretsu commented Apr 3, 2021

From experimentation this appears to be happening when using ts-node --files with rootDir. I suspect related to the explanation here microsoft/TypeScript#9858

The solution for me was removing rootDir

@ferm10n
Copy link

ferm10n commented Apr 15, 2021

From experimentation this appears to be happening when using ts-node --files with rootDir. I suspect related to the explanation here microsoft/TypeScript#9858

The solution for me was removing rootDir

Also fixed by removing rootDir.

@jeanlescure
Copy link

I have a repo with two packages (let's call them a and b).

I use yarn workspaces to be able to use package b as a dependency on package a.

When package a imports from package b, it is importing the generated js files under dist (basically as if it was importing from most packages available using yarn add/npm install).

I set up some tests on package a. When I run them using ts-node I get the error:

TypeError: ../b/dist/index.js: Emit skipped

It would seem that ts-node is resolving the symbolic link that yarn sets up pointing to package b as a relative path (hence the ../b in the error) and thus treating that external js as if it was part of the local code.

In my case setting allowJs: false works to solve the problem, confusingly somehow (?), but it seems to be probably an undesired side-effect, that also restricts me from being able to have js files on package a.

For now I'm glad to have a workaround.

Hope this helps others and hope it sheds a light on a possible solution for the TypeScript team.

Cheers

@Aelerinya
Copy link

I have the same problem as @jeanlescure. Using yarn workspaces, ts-node refuses to launch a script importing things from another workspace package, and fails with this Emit skipped error.

azu added a commit to textlint/textlint that referenced this issue May 22, 2021
avoid "ts-node Emit skipped allowjs" error TypeStrong/ts-node#693
azu added a commit to textlint/textlint that referenced this issue May 22, 2021
* CI: drop support Node.js 10.x

* fix(textlint): update engines field for ESM

* style: apply prettier

* CI: support Node.js 16

* chore: fix type

* chore: remove .js

* chore: omit allowJs

* chore: omit allowJs

* fix

* refactor: remove "rootDir" in tsconfig.json

avoid "ts-node Emit skipped allowjs" error TypeStrong/ts-node#693

* chore: rm debug

* fix test

* fix test

* fix test

* fix test

* fix bin

* update

* fix: example
@cspotcode
Copy link
Collaborator

@jeanlescure When you import b, which resolves to ../b/dist/index.js, are you wanting ts-node to resolve that to ../b/src/index.ts and to compile index.ts?

This is something I've wanted to implement for a little while now. It'll take some doing to get it right, but we can be smart about understanding the relationship between dist and src directories. When node tries to import something from dist, we can redirect to src.

I believe when you turn off allowJs, you're allowing node to execute the b/dist/index.js from disk without any compilation, but that's not what you want (correct me if I'm wrong) You really want ts-node to compile and run b/src/index.ts

@jeanlescure
Copy link

@cspotcode , as you put it, I'm going to correct you, the assumption is wrong and opposite to what we want 😅

In my case I do not want b to be compiled. No compilation is needed because b is already compiled. A workspace in yarn/npm workspaces is a separate package on the project with its own set of compilation scripts and config. As far as a is concerned, b should be seen as a dependency just like typescript, react, etc.

I think the piece of context missing here is that this is what the import looks like:

import b from 'b';

There is no relative path, this is something that yarn/npm workspaces allows because in the node_modules directory a symbolic link is created.

So what we are saying is, even though the import suggests that b is referring to a package, ts-node is somehow expanding the import to the relative path the symbolic link points to, and in turn interpreting the import as a relative path, thus trying to compile something it's not supposed to.

I then understand that, with allowJs set to false, this allows node to execute the b/dist/index.js from disk without any compilation. IMHO the logic that allows this should not be attached to allowJs since I want both to be able to have js files in my a package and be able to import the symlinked version of b without it being compiled (as long as the import implies that b is a package and not a relative path to local js code).

@cspotcode
Copy link
Collaborator

cspotcode commented May 26, 2021

@jeanlescure I see, I think our scope option is the right choice for you. I put an explanation at the bottom of this comment.

The expansion is actually done by node. You can see this with require.resolve('b'). I believe either TypeScript diagnostics or ts-node display the error with a relative path for readability, but node is the one resolving to an absolute path ending in dist/index.js. Node also follows symlinks by default.

ts-node's decision to compile is not based on whether the path is relative or not. It's based on TypeScript's allowJs and jsx options to decide which file extensions are compiled, and ts-node's ignore, skipIgnore, scope, and scopeDir options to decide which paths are allowed.

I can understand why your project does not want ts-node to compile other modules in the workspace, but that's not the case for all projects. Some want to write code across the monorepo and test it all via ts-node without needing to recompile anything manually. Understanding your use-case has been helpful for me, so I appreciate the detailed response.


How to use scope on your project today

scope limits ts-node to compiling files only within a given directory, scopeDir. In v10 scope and scopeDir were moved to be API-only options, and TS_NODE_SCOPE was deprecated (Release notes) However, if this option is important to your project, we can un-deprecate it and allow specifying them via tsconfig and CLI flags.

To test this today, I believe you can set env var TS_NODE_SCOPE=true and run your code. scopeDir defaults to your rootDir so it should exclude anything in the b module.

If this works for you, please let me know and we can add it to Discussions as an official recipe.

@jeanlescure
Copy link

@cspotcode scope is exactly what I need. I've tested adding TS_NODE_SCOPE=true as you suggested, it works, if I change my rootDir.

You've hit the nail in the head because I would actually need to have separate scopeDir and rootDir. In my case I'm only using ts-node to run unit tests which are in a separate directory than src (which is my rootDir), so setting scopeDir to the directory that contains both src and unit-tests by CLI flag or tsconfig.test.json would be ideal.

My vote is for un-deprecate ✋🏼 😄

@cspotcode
Copy link
Collaborator

Ok, excellent, I've created #1346 to add scope as a CLI and tsconfig option.

As far as setting the appropriate scopeDir, I believe you can add a ts-node override for rootDir like this:

// tsconfig.json
{
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "dist",
    // ...
  },
  "ts-node": {
    "compilerOptions": {
      "rootDir": "."
    }
  }
}

Will that work for you?

@jeanlescure
Copy link

@cspotcode works great. Thanks 👍🏼

@chenrui333
Copy link

chenrui333 commented Jul 28, 2021

I tried the ts-node option with ts-node 10.1.0, unfortunately, I am still getting the throw new TypeError(${relative(cwd, fileName)}: Emit skipped) error.

// tsconfig.json
  "ts-node": {
    "compilerOptions": {
      "rootDir": "."
    }
  }

@chenrui333
Copy link

This actually resolved my problem of running ts-node 10.1.0

+  "ts-node": {
+    "transpileOnly": true
+  },

@brighterfrog
Copy link

I had a mixture of ts and js in a library and was hitting this issue. Since I'm using AWS amplify and importing my queries and mutations into my typescript project from a central library, I needed to change the sourcing from import { something } from '../../location', to const { something } = require('../../graphql/queries')

@cspotcode cspotcode added this to the 10.5.0 milestone Feb 7, 2022
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Feb 16, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-node](https://typestrong.org/ts-node) ([source](https://github.com/TypeStrong/ts-node)) | devDependencies | minor | [`10.4.0` -> `10.5.0`](https://renovatebot.com/diffs/npm/ts-node/10.4.0/10.5.0) |

---

### Release Notes

<details>
<summary>TypeStrong/ts-node</summary>

### [`v10.5.0`](https://github.com/TypeStrong/ts-node/releases/v10.5.0)

[Compare Source](TypeStrong/ts-node@v10.4.0...v10.5.0)

<!--
  I don't make a discussion thread for every release.  Github has a button to make a discussion thread for a release.
  Then I update the discussion thread to remove the release notes and instead link to the release.
-->

Questions about this release? Ask in the official discussion thread: [#&#8203;1634](TypeStrong/ts-node#1634)

**Added**

-   Eliminate "Emit Skipped" errors ([#&#8203;693](TypeStrong/ts-node#693), [#&#8203;1345](TypeStrong/ts-node#1345), [#&#8203;1629](TypeStrong/ts-node#1629))
    -   Avoids all "Emit Skipped" errors by performing a fallback `transpileOnly`-style transformation.
    -   Does not affect typechecking.  Type errors are still detected and thrown.
    -   Fallback has the same limitations as `isolatedModules`. This will only affect rare cases such as using `const enums` with `preserveConstEnums` disabled.
    -   Fixes [#&#8203;693](TypeStrong/ts-node#693)
-   Graduate swc transpiler out of experimental; add `swc: true` convenience option ([docs](https://typestrong.org/ts-node/docs/transpilers)) ([#&#8203;1487](TypeStrong/ts-node#1487), [#&#8203;1536](TypeStrong/ts-node#1536), [#&#8203;1613](TypeStrong/ts-node#1613), [#&#8203;1627](TypeStrong/ts-node#1627))
    -   `"swc": true` or `--swc` will use swc for faster execution
    -   This feature is no longer marked "experimental."  Thank you to everyone who filed bugs!
-   swc transpiler attempts to load `@swc/core` or `@swc/wasm` dependencies from your project before falling-back to global installations ([#&#8203;1613](TypeStrong/ts-node#1613), [#&#8203;1627](TypeStrong/ts-node#1627))
    -   global fallback only occurs when using a global installation of ts-node
-   Add support for TypeScript's `traceResolution` output ([docs](https://www.typescriptlang.org/tsconfig/#traceResolution)) ([#&#8203;1128](TypeStrong/ts-node#1128), [#&#8203;1491](TypeStrong/ts-node#1491)) [@&#8203;TheUnlocked](https://github.com/TheUnlocked)
-   Support import assertions in ESM loader ([docs](https://nodejs.org/dist/latest-v17.x/docs/api/esm.html#import-assertions)) ([#&#8203;1557](TypeStrong/ts-node#1557), [#&#8203;1558](TypeStrong/ts-node#1558), [#&#8203;1559](TypeStrong/ts-node#1559), [#&#8203;1573](TypeStrong/ts-node#1573)) [@&#8203;Pokute](https://github.com/Pokute), [@&#8203;geigerzaehler](https://github.com/geigerzaehler)
    -   Allows importing JSON files from ESM with the requisite flag ([docs](https://nodejs.org/dist/latest-v17.x/docs/api/esm.html#json-modules))
-   `ts-node -vvv` also logs absolute paths to `ts-node` and `typescript`, to make it more obvious when you're accidentally using globally-installed versions ([#&#8203;1323](TypeStrong/ts-node#1323), [#&#8203;1620](TypeStrong/ts-node#1620))
-   Add swc target "es2022" ([#&#8203;1535](TypeStrong/ts-node#1535), [#&#8203;1540](TypeStrong/ts-node#1540))
    -   When you have target es2022 in tsconfig, will use swc's es2022 target

**Changed**

-   Initialize TypeScript compiler before starting REPL prompt ([#&#8203;1498](TypeStrong/ts-node#1498)) [@&#8203;TheUnlocked](https://github.com/TheUnlocked)
    -   Improves responsiveness for first line of REPL input
-   Use `v8-compile-cache-lib` to load typescript
    -   improves startup time ([#&#8203;1339](TypeStrong/ts-node#1339), [#&#8203;1603](TypeStrong/ts-node#1603))
-   Support both `--camelCase` and `--hyphen-case` for all CLI flags; update documentation to use `--camelCase` ([#&#8203;1598](TypeStrong/ts-node#1598), [#&#8203;1599](TypeStrong/ts-node#1599))
    -   Not a breaking change; CLI continues to accept both forms
-   Make `TSError` `diagnosticText` property non-enumerable to prevent it from being logged below the stack ([#&#8203;1632](TypeStrong/ts-node#1632))

**Fixed**

-   Fix [#&#8203;1538](TypeStrong/ts-node#1538): REPL inputs fail to transpile via swc ([#&#8203;1538](TypeStrong/ts-node#1538), [#&#8203;1541](TypeStrong/ts-node#1541), [#&#8203;1602](TypeStrong/ts-node#1602))
-   Fix [#&#8203;1478](TypeStrong/ts-node#1478): REPL erroneously logged `undefined` for all inputs after the first when using swc transpiler ([#&#8203;1478](TypeStrong/ts-node#1478), [#&#8203;1580](TypeStrong/ts-node#1580), [#&#8203;1602](TypeStrong/ts-node#1602))
-   Fix [#&#8203;1389](TypeStrong/ts-node#1389): In `--showConfig` output, emit accurate `moduleTypes` paths resolved relative to the `tsconfig.json` which declared them ([#&#8203;1389](TypeStrong/ts-node#1389), [#&#8203;1619](TypeStrong/ts-node#1619))
-   Fix: Remove indentation from `ts-node --help` output ([#&#8203;1597](TypeStrong/ts-node#1597), [#&#8203;1600](TypeStrong/ts-node#1600))
-   Fix [#&#8203;1425](TypeStrong/ts-node#1425): Merged definitions correctly into `tsconfig.schemastore-schema.json` ([#&#8203;1425](TypeStrong/ts-node#1425), [#&#8203;1618](TypeStrong/ts-node#1618))
-   Fix: Allow disabling `"use strict"` emit in SWC transpiler ([#&#8203;1531](TypeStrong/ts-node#1531), [#&#8203;1537](TypeStrong/ts-node#1537))
-   Fix: Add missing `ERR_UNKNOWN_FILE_EXTENSION` constructor; was throwing `ERR_UNKNOWN_FILE_EXTENSION is not a constructor` ([#&#8203;1562](TypeStrong/ts-node#1562)) [@&#8203;bluelovers](https://github.com/bluelovers)
-   Fix [#&#8203;1565](TypeStrong/ts-node#1565): entrypoint resolution failed on node v12.0.x and v12.1.x ([#&#8203;1565](TypeStrong/ts-node#1565), [#&#8203;1566](TypeStrong/ts-node#1566)) [@&#8203;davidmurdoch](https://github.com/davidmurdoch)

#### Docs

-   Explain `env -S` flag for shebangs ([docs](https://typestrong.org/ts-node/docs/usage#shebang)) ([#&#8203;1448](TypeStrong/ts-node#1448), [#&#8203;1545](TypeStrong/ts-node#1545)) [@&#8203;sheeit](https://github.com/sheeit), [@&#8203;chee](https://github.com/chee)
-   Suggest `skipIgnore` when you want to compile files in node_modules ([docs](https://typestrong.org/ts-node/docs/how-it-works)) ([#&#8203;1553](TypeStrong/ts-node#1553)) [@&#8203;webstrand](https://github.com/webstrand)
-   Fix typo in `moduleTypes` on options page ([docs](https://typestrong.org/ts-node/docs/options)) ([#&#8203;1630](TypeStrong/ts-node#1630), [#&#8203;1633](TypeStrong/ts-node#1633))

#### Misc

-   Adds experimental `experimentalResolverFeatures` option, but it does not do anything yet ([#&#8203;1514](TypeStrong/ts-node#1514), [#&#8203;1614](TypeStrong/ts-node#1614))

https://github.com/TypeStrong/ts-node/milestone/4

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1156
Reviewed-by: crapStone <crapstone@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
@khankid
Copy link

khankid commented Jun 21, 2022

This actually resolved my problem of running ts-node 10.1.0

+  "ts-node": {
+    "transpileOnly": true
+  },

Why did this work?

@blakeembrey
Copy link
Member

This actually resolved my problem of running ts-node 10.1.0

+  "ts-node": {
+    "transpileOnly": true
+  },

Why did this work?

It disables type checking, and emit skipped is an issue due to the type checker. It won’t compile files outside the typescript project when it’s type checking them.

@cspotcode
Copy link
Collaborator

Note that modern versions of ts-node entirely avoid this emit skipped error. We detect when the typechecker skips emit, and we fallback to an alternative transpilation. The end result is that users of modern ts-node never see emit skipped even when typechecking.

@cspotcode
Copy link
Collaborator

cspotcode commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.