You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of today specifying ES6 as a module format to transpile to with ES5 as a target will result in the "error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower." error.
But having ES6 modules in the ES5 output would be beneficial for ES6-based tree-shakers like Rollup.
Currently one can ES5 output with ES6 modules by using ts.transpileModule(...) but the output is broken in some cases. For example transpiling:
ts.version// 1.7.4ts.transpileModule('export class A {}',{compilerOptions: {target: ts.ScriptTarget.ES5,module: ts.ModuleKind.ES6}})
yields:
varA=(function(){functionA(){}returnA;})();A=A;
Notice: A = A; which should probably be export { A };
Given the above I've got a question: do you plan to support ES6 modules for ES5 output? If not are you planning to provide a TS-specific tree-shaking bundler?
The text was updated successfully, but these errors were encountered:
As of today specifying ES6 as a module format to transpile to with ES5 as a target will result in the "error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower." error.
But having ES6 modules in the ES5 output would be beneficial for ES6-based tree-shakers like Rollup.
Currently one can ES5 output with ES6 modules by using
ts.transpileModule(...)
but the output is broken in some cases. For example transpiling:yields:
Notice:
A = A;
which should probably beexport { A };
In-depth discussion and more examples in rollup/rollup-plugin-typescript#9
Given the above I've got a question: do you plan to support ES6 modules for ES5 output? If not are you planning to provide a TS-specific tree-shaking bundler?
The text was updated successfully, but these errors were encountered: