choojs / bankai

:station: - friendly web compiler
Apache License 2.0
1.09k stars 102 forks source link

typescript support #285

Closed IzumiSy closed 1 year ago

IzumiSy commented 7 years ago

I would like to use bankai with TypeScript transpiler, but README does not have any section to introduce transpilers. Do you have any guidance?

Flet commented 7 years ago

Solution will be similar to #262 I think

cancerberoSgx commented 6 years ago

@IzumiSy I don't think is responsibility of this tool to run transpilers. I think the idea of the project is to accept a browserify valid project as input. generating such a project from a TS project is just a matter of having this tsconfig.json:

{
  "compilerOptions": {
    "target": "es2018",   
    "module": "commonjs", 
    "moduleResolution": "node",
    "jsx": "react",
    "lib": ["es2018", "dom"],
    "outDir": "./dist", 
    "rootDir": "./src",
    "strict": true
  }
}

then just execute tsc before bankai:

tsc && bankai build dist/src/index.js 

My opinion is that we, the users, should be responsible of the build workflow and each tool should be focused on a particular problem, and not be responsible of the workflow. This way I can switch bankai with other optimization tool easily since my build is not dependent on it just on a command file input-output contract.

And in any case, if there's a tool responsible of implementing the build workflow / chain, it should be a tool specialized on that (like gulp orchestrator) and I don't think bankai applies here. Just an opinion.