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

Comments in export default are removed in production mode #8085

Closed
jddxf opened this issue Sep 25, 2018 · 0 comments
Closed

Comments in export default are removed in production mode #8085

jddxf opened this issue Sep 25, 2018 · 0 comments

Comments

@jddxf
Copy link

jddxf commented Sep 25, 2018

Bug report

What is the current behavior?
Webpack generates output in production mode without minimizers

/* harmony default export */ var src_bar = (Math.abs(0));

for the code below

// ./src/bar.ts
export default /*@__PURE__*/Math.abs(0);

However, if I write code like this

const value = /*@__PURE__*/Math.abs(0);
export default value;

the comment is reserved

var value = /*@__PURE__*/Math.abs(0);
/* harmony default export */ var src_bar = (value);

This behavior brings me some troubles. I have to preprocess my code to split all the inline default exports.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
Perhaps webpack should reserve the comments as below

/* harmony default export */ var src_bar = /*@__PURE__*/(Math.abs(0));

I'm not sure though, since the comments may be considered to belong to the export statement.

Other relevant information:
webpack version: 4.20.1
Related issue: #8039

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

1 participant