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

Bug: iife should startsWith var instead of const evev if i set preset to es2015 #4585

Closed
Jackie1210 opened this issue Jul 23, 2022 · 3 comments · Fixed by #4588
Closed

Bug: iife should startsWith var instead of const evev if i set preset to es2015 #4585

Jackie1210 opened this issue Jul 23, 2022 · 3 comments · Fixed by #4588

Comments

@Jackie1210
Copy link

Rollup Version

2.77.0

Operating System (or Browser)

macOS

Node Version (if applicable)

16.13.0

Link To Reproduction

https://stackblitz.com/edit/rollup-template-83kwfj?file=rollup.config.js

Expected Behaviour

var lib = (function (exports) {
	'use strict';

	// run `node index.js` in the terminal

	const a = 'a';

	exports.a = a;

	Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });

	return exports;

})({});

Actual Behaviour

const lib = (function (exports) {
	'use strict';

	// run `node index.js` in the terminal

	const a = 'a';

	exports.a = a;

	Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });

	return exports;

})({});
@Jackie1210 Jackie1210 changed the title Bug: iife should startsWith var instead of const Bug: iife should startsWith var instead of const evev if i set preset to es2015 Jul 23, 2022
@lukastaegert
Copy link
Member

lukastaegert commented Jul 24, 2022

What is the bug you experience? When executed in a script scope, doesn't const still declare a global variable?

@Jackie1210
Copy link
Author

@lukastaegert yep,you can check this.

vitejs/vite#9318

@lukastaegert lukastaegert mentioned this issue Jul 26, 2022
9 tasks
@lukastaegert
Copy link
Member

Fix at #4588

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.

2 participants