microsoft/TypeScript-Node-Starter

client ts files and server ts files should compile to diffrent target

clysto opened this issue · 3 comments

In the tsconfig.json:

{
    "compilerOptions": {
        "module": "commonjs",
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,

        /* ----------there---------- */
        "target": "es6",  

        "noImplicitAny": true,
        "moduleResolution": "node",
        "sourceMap": true,
        "outDir": "dist",
        "baseUrl": ".",
        "paths": {
            "*": [
                "node_modules/*",
                "src/types/*"
            ]
        }
    },
    "include": [
        "src/**/*"
    ]
}

Es6 is not supported for some browsers. I think we should compile the frontend code and the backend code separately.

Yes, that correct and valid point, if we keep the IE11 as supported target, not for evergreens. I think this is outside of this template focus I believe, to provide fine tuned client side compilation tooling. But someone could propose solution based on the simple RollupJS config for client code (Rollup + TS support plugin exporting to ES5 UMD).

@peterblazejewicz I was thinking about separation of concerns too. It might be easier to contribute without sidetracking if the community knew what the goals and roadmap are. There is a bit of cleanup and updating that could happen...

The tsconfig now suppports this layered confguration, so we could have base/server/client and differnt targets in package.json scripts. How does it sounds? The regular client code without the introduction of ES6 complex imports, compiles just fine with tsc, no other tooling required.
I'm not thinking about composite projects, for the sake of the simplicity:
https://www.typescriptlang.org/docs/handbook/project-references.html