Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does Babel loader beautify code automatically? #905

Open
hongrunhui opened this issue May 8, 2021 · 2 comments
Open

Why does Babel loader beautify code automatically? #905

hongrunhui opened this issue May 8, 2021 · 2 comments

Comments

@hongrunhui
Copy link

I need help

Why does Babel loader beautify code automatically?
I want to keep it as it is. Is there any way to set it?

Webpack Version:
5.30.0

Babel Core Version:
7.13.14

Babel Loader Version:
8.2.2

Please tell us about your environment:
OSX 11
Current behavior:

image

Expected/desired behavior:

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.

  • What is the expected behavior?

  • What is the motivation / use case for changing the behavior?

@JLHwung
Copy link
Contributor

JLHwung commented May 8, 2021

Babel does not try to preserve the code styles of input. If you want to preserve whitespaces, you can use recast. Or in your cases, if you want to minify the output, you can pass the Babel generated code to terser.

@hongrunhui
Copy link
Author

I don't want to minify code , I just want preserve the code styles of input, i remember the lower version babel-loader will not beautify code automatically
if it is no way to config , OK, I will try other way, thx!

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

No branches or pull requests

2 participants