Git Product home page Git Product logo

Comments (7)

blakeembrey avatar blakeembrey commented on May 22, 2024

@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.

darthtrevino avatar darthtrevino commented on May 22, 2024

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.

blakeembrey avatar blakeembrey commented on May 22, 2024

@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.

blakeembrey avatar blakeembrey commented on May 22, 2024

It sounds like you're actually after a different feature? The ability to pass in compiler options that override tsconfig.json?

from ts-node.

darthtrevino avatar darthtrevino commented on May 22, 2024

Correct

from ts-node.

blakeembrey avatar blakeembrey commented on May 22, 2024

@darthtrevino #54

from ts-node.

darthtrevino avatar darthtrevino commented on May 22, 2024

Sweet! Thanks @blakeembrey !

from ts-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.