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

Function call disappear if there is a comment above it #79

Closed
NeeEoo opened this issue Mar 10, 2019 · 2 comments
Closed

Function call disappear if there is a comment above it #79

NeeEoo opened this issue Mar 10, 2019 · 2 comments

Comments

@NeeEoo
Copy link

NeeEoo commented Mar 10, 2019

  • Operating System: Windows 10
  • Node Version: v10.9.0
  • NPM Version: 6.4.1
  • webpack Version: 4.29.6
  • terser-webpack-plugin Version: 1.2.3

Expected Behavior

The registerCmd function call should not disappear when there is a comment above it

Actual Behavior

The registerCmd function call disappears from the output

Code

/*registerCmd("cal", function(argv) { // Old code
   // ... 142 lines of private code
}, "cal - Shows a calendar")*/

registerCmd("cal", function(argv) { // New code
   // ... 154 lines of private code
}, "cal - Shows a calendar")
const TerserPlugin = require('terser-webpack-plugin');
// ...
new TerserPlugin({
    terserOptions: {
        mangle: true,
        output: {
            comments: /@license/i
        },
        ecma: 8,
        compress: {
            unsafe: true,
            sequences: true,
            passes: 5
        },
        parallel: true
    },
    parallel: true
})

How Do We Reproduce?

Cannot provide a repo because my project is closed source

@NeeEoo
Copy link
Author

NeeEoo commented Mar 10, 2019

I found why the function call disappears it is because the old code comment had #__PURE__ so the function call became pure

@alexander-akait
Copy link
Member

We just wrapper around terser (https://github.com/terser-js/terser), if you think it is bug please open issue in their repo, we can't do something on our side (we don't modify your code, just send this code to terser and return output), thanks!

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