Comments (7)
@terasaka2k This is correct. The sourceMap
options need to override the user settings, there's specially handling for it. The user, however, could output ES6 or ES3 if they so wished. Same with the module environment.
Edit: Accidentally hit enter.
from ts-node.
Consider this use case: I'm using webpack to chain the typescript-loader and the babel-loader together to take advantage of babel's hook runtime for things like HMR. I want my tsconfig.json to target ES6 and let the babel-loader transpile from ES6 to ES5 for browsers.
However, in my server code, I want to go straight from TS to ES5. I would like to be able to do this:
# index.js - server entry point
require('ts-node').register({
compilerOptions: {
target: 'es5'
}
})
And then what I would expect to happen in ts-node would be something like:
const defaultConfig = { target: 'es5', module: 'commonjs' };
const tsConfigFromFile = readFromTsConfigJson();
Object.assign({}, defaultConfig, tsConfigFromFile, tsConfigFromArgs)
from ts-node.
@darthtrevino I'm not sure who you're responding to, but that's how it works already and the reason I closed the issue. However, there's no compilerOptions
pass in to ts-node
, it's all from tsconfig.json
.
from ts-node.
It sounds like you're actually after a different feature? The ability to pass in compiler options that override tsconfig.json
?
from ts-node.
Correct
from ts-node.
from ts-node.
Sweet! Thanks @blakeembrey !
from ts-node.
Related Issues (20)
- In REPL, can't access the previous line's return value via `_`
- Error when using ts-node with tsonfig/bases and typescript 5.3.2 HOT 3
- "TypeError: require(...) is not a function" in ts-node dependecy
- extends of tsconfig.json doesn't work when it reference to other package HOT 2
- add --env-file environment variable similar to node v:20.6.0 HOT 9
- ERR_UNKNOWN_FILE_EXTENSION since Node.js 18.19.0 (works fine with 18.18.2) HOT 17
- Support clearing the local context with .clear when starting programmatically
- In #!/bin/bash clear apt update apt upgrade apt install figlet -y figlet Basic Installation apt install toilet -y apt install cowsay -y apt install nano -y apt install ruby -y gem install lolcat figlet -f big Done !!! | lolcat echo echo -e "\e[1m Now Run \e[32mbash t-ban.sh\e[0m...!!!" echo echo -e "\e[1m\e[32m Developed by :\e[33m Sutariya Parixit (8h4i)" echo echo( there are Issu for In title The Over view and synonyms Not Seen in his real formet
- ts-node is unable to resolve tsconfig files in Yarn workspace HOT 2
- ESM: Cannot find module './index.js' and requiring "imaginaryUncacheableRequireResolveScript" HOT 1
- TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" in Node v21.5.0 HOT 36
- "Cannot find package" when running mocha and importing between packages in monorepo HOT 1
- Can't use `--eval` with ESM
- calling `repl.start()` causes a doubling of stdin/stdout
- ts-node cannot run mixed ESM/CJS project HOT 2
- Cryptic error on invalid tsconfig.json, e.g. if attempting to extend nonexistent tsconfig file
- ts-node doesn't resolve extended tsconfigs if they originate from the export fields of packages
- [Error [ERR_REQUIRE_ESM]: require() of ES Module /.../node_modules/ts-node/esm.mjs not supported. HOT 1
- [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated when using node 22
- Setting emitAssertForImportAttributes no longer works in Node.js 22 with latest swc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts-node.