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

Please support es module #1706

Closed
ten9miq opened this issue Sep 9, 2019 · 2 comments · Fixed by #1781
Closed

Please support es module #1706

ten9miq opened this issue Sep 9, 2019 · 2 comments · Fixed by #1781

Comments

@ten9miq
Copy link

ten9miq commented Sep 9, 2019

Input

The code looked like this before beautification:

<script type="text/javascript">
	import module from "module";
	(async () => { let get = new module(); await get.d(); console.log(get.g()); })();
</script>

<script type="module" crossorigin="use-credentials">
	import module from "module";
	(async () => { let get = new module(); await get.d(); console.log(get.g()); })();
</script>

Expected Output

The code should have looked like this after beautification:

<script type="text/javascript">
	import module from "module";
	(async () => {
		let get = new module();
		await get.d();
		console.log(get.g());
	})();
</script>

<script type="module" crossorigin="use-credentials">
	import module from "module";
	(async () => {
		let get = new module();
		await get.d();
		console.log(get.g());
	})();
</script>

Actual Output

The code actually looked like this after beautification:

<script type="text/javascript">
	import module from "module";
	(async () => {
		let get = new module();
		await get.d();
		console.log(get.g());
	})();
</script>

<script type="module" crossorigin="use-credentials">
	import module from "module";
	(async () => { let get = new module(); await get.d(); console.log(get.g()); })();
</script>

Environment

OS:Windows 10

Settings

Example:

{
    "indent_size": 4,
    "indent_char": "\t",
    "indent_level": 0,
    "indent_with_tabs": false,
    "preserve_newlines": true,
    "max_preserve_newlines": 10,
    "jslint_happy": false,
    "space_after_anon_function": false,
    "brace_style": "collapse,preserve-inline",
    "keep_array_indentation": false,
    "keep_function_indentation": false,
    "space_before_conditional": true,
    "break_chained_methods": false,
    "eval_code": false,
    "unescape_strings": false,
    "wrap_line_length": 120
}
@gMan1990
Copy link

+1, Please support es module.
<script type="module">

@bitwiseman
Copy link
Member

This should be relatively easy to add. Thanks for drawing attention back to this, it slipped through the cracks.

bitwiseman added a commit to bitwiseman/js-beautify that referenced this issue Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants