Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

babelOptions ignored in esm compiler #700

Closed
malaupa opened this issue Sep 27, 2016 · 11 comments
Closed

babelOptions ignored in esm compiler #700

malaupa opened this issue Sep 27, 2016 · 11 comments

Comments

@malaupa
Copy link

malaupa commented Sep 27, 2016

babelOptions defined in jspm.conf.js or by direct calling SystemJS.conf() or System.conf() are not passed to the babel transpiler in https://github.com/systemjs/builder/blob/master/compilers/esm.js#L59. Isn't it needed at this place? This causes warnings of the babel transpiler for large files, because compact mode can't be enabled : https://github.com/babel/babel/blob/master/packages/babel-generator/src/index.js#L81.

@guybedford
Copy link
Member

This is a different transpilation which only converts ES modules into System.register, separate to the other Babel transforms.

An option to pass compact here could be worth providing though.

@malaupa
Copy link
Author

malaupa commented Sep 27, 2016

Why is Babel called twice? Babel could do all transpilation in one step for a file or I am wrong!? Please, could you shortly explain in which steps the builder transpiles the source code files?

Why is it hard to achieve to set the compact option for the transform operation? The options object is present on the builder instance or isn't it?

Thanks for answering in advance

@guybedford
Copy link
Member

Are you trying to turn compact on or off?

@malaupa
Copy link
Author

malaupa commented Sep 27, 2016

Yes, by setting in jspm.conf.js and by .babelrc, but the call at line esm.js#59 doesn't pass the compact option. I have debugged it by creating a gulp task and call the Builder directly.

@guybedford
Copy link
Member

Specifically I was wondering what value you wanted for the compact option, to understand the use case better.

@malaupa
Copy link
Author

malaupa commented Sep 27, 2016

Sorry, I want to disable the warning by using compact=true, which is logged for compact="auto" (default value) in line index.js#L81 for large files.

@guybedford
Copy link
Member

I'd be open to setting a hard default of compact: false if you think that could work.

@malaupa
Copy link
Author

malaupa commented Sep 27, 2016

Yes, this should work.

For understanding systemjs and systemjs/builder in more detail, do you have a short description, documentation for the internal architecture? It would be helpful for using systemjs in the correct intended way. Especially for Babel. I saw you are working on docs, could it be part of it?

Thanks

@laurentgoudet
Copy link
Contributor

I'd be open to setting a hard default of compact: false if you think that could work.

I'd love to have a compact: false hard default as well. Not only to remove the annoying [BABEL] Note: The code generator has deoptimised the styling of "..." as it exceeds the max of "100KB". warnings, but also because it makes debugging such modules such harder due to the deoptimised styling.

@guybedford
Copy link
Member

Sure, added in 8a73596.

@guybedford
Copy link
Member

Released in 0.15.33.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants