grunt-traceur icon indicating copy to clipboard operation
grunt-traceur copied to clipboard

Build Into One File

Open aaronfrost opened this issue 10 years ago • 3 comments

@mciparelli we should probably support building into one file. The reason being that because we have sourcemap support, if people concat their own files, then their sourcemaps are worthless, as they don't correspond to the actual original source file. So, if people specify a "concat" options or whatever, we should then concat their files, and then compile the files.

Thoughts?

aaronfrost avatar Jan 19 '15 21:01 aaronfrost

I would still consider calling some Traceur API to recursively load dependencies (recursiveModuleCompileToSingleFile?). That would allow grunt-traceur users to specify a source file as an entrance to their application and the respective output file. Just loading that file would make the app run for them. Now until such thing is decided in here: https://github.com/google/traceur-compiler/issues/1626 we definitely could add some option to concat before compiling (which has actually nothing to do with recursive compilation of dependencies, ha). Or even better maybe do it automatically if (src.length > dest.length), but then that won't work for every modules Traceur option, so I suppose we should check if the user is using a modules option that allows for manyToOne compilation in order to be able to warn them when they try to compile many files into one for, say, register which I think doesn't support many modules per-file.

mciparelli avatar Jan 20 '15 01:01 mciparelli

@aaronfrost would you prefer this concat to happen automatically when it detects src > 1 or should the user specify a concat option? Would you warn in console to the user that is trying to do a manyToOne compilation indicating that the contents will be concatted before transpiled?

mciparelli avatar Feb 20 '15 14:02 mciparelli

I am myself coding one class per module, hence --out is needed for a deployment build (currently run a shell script).

gso avatar Apr 19 '15 14:04 gso