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

Wrong system format output after tree shaking if export is a ternary expression #4201

Closed
alvinleung1996 opened this issue Aug 7, 2021 · 1 comment · Fixed by #4202
Closed

Comments

@alvinleung1996
Copy link

Rollup Version

v2.56.0

Operating System (or Browser)

Debian 10

Node Version (if applicable)

No response

Link To Reproduction

https://rollupjs.org/repl/?version=2.56.0&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMGNvbnN0JTIwYSUyMCUzRCUyMHdpbmRvdy5jb25maWclMjAlM0YlMjAxJTIwJTNBJTIwMiU1Q25leHBvcnQlMjBjb25zdCUyMGIlMjAlM0QlMjB0cnVlJTIwJTNGJTIwMSUyMCUzQSUyMDIlNUNuZXhwb3J0JTIwY29uc3QlMjBjJTIwJTNEJTIwZmFsc2UlMjAlM0YlMjAxJTIwJTNBJTIwMiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMnN5c3RlbSUyMiUyQyUyMm5hbWUlMjIlM0ElMjJteUJ1bmRsZSUyMiUyQyUyMmFtZCUyMiUzQSU3QiUyMmlkJTIyJTNBJTIyJTIyJTdEJTJDJTIyZ2xvYmFscyUyMiUzQSU3QiU3RCU3RCUyQyUyMmV4YW1wbGUlMjIlM0FudWxsJTdE

Expected Behaviour

System.register('myBundle', [], function (exports) {
	'use strict';
	return {
		execute: function () {

			const a = exports('a', window.config ? 1 : 2);
			const b = exports('b', 1);
			const c = exports('c', 2);

		}
	};
});

Actual Behaviour

System.register('myBundle', [], function (exports) {
	'use strict';
	return {
		execute: function () {

			const a = exports('a', window.config ? 1 : 2);
			const b = 1 ;
			const c = 2);

		}
	};
});
@alvinleung1996 alvinleung1996 changed the title Wrong system format output if export is a ternary expression after tree shaking Wrong system format output after tree shaking if export is a ternary expression Aug 7, 2021
@lukastaegert
Copy link
Member

Thanks for spotting, fix at #4202

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