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

Sourcemaps not working with minification #187

Closed
aulbach opened this issue Dec 2, 2019 · 13 comments
Closed

Sourcemaps not working with minification #187

aulbach opened this issue Dec 2, 2019 · 13 comments

Comments

@aulbach
Copy link

aulbach commented Dec 2, 2019

  • Operating System: Windows10
  • Node Version: v12.13.0
  • NPM Version: 6.12.0
  • webpack Version: 4.41.2
  • terser-webpack-plugin Version: 1.4.1

Expected Behavior

Sourcemap of typescript stack is logged on error.

Actual Behavior

Sourcemaps logs stack of compiled javascript, which is useless for typescript application. It works, if we turn minification off.

Code

No code needed

How Do We Reproduce?

webpack.config.prod:

    devtool: 'source-map',
    optimization: {
        // Test
        minimize: false,
    },

--> turns minification off and makes that sourcemap is working.

This bug seems to come in with 1.4. (not sure, cause we jumped from 1.1 to 1.4)

There are other issues, which point to be valid for 2.1, too.

I will try to test, if the same bug happens with 2.1 and 1.3 and will report here.

@alexander-akait
Copy link
Member

Please create reproducible test repo, i can't understand problem not working with minification

@aulbach
Copy link
Author

aulbach commented Dec 3, 2019

I'm sorry, we invested yesterday some hours to find out, what's not working.
For example, we tested it with 2.1, by using minimizer: [new TerserPlugin()],, but same effect. We tried to turn off caching. And some more ideas. All ideas didn't change the outcome - see above.
What we didn't tried is to look, if the problem comes from terser itself. But because we had a solution for our problem and the project has no problem with a little bit longer code we decided to keep it currently as it is.
Eventually we will come back to this problem next year - no promise. But if, I promise to write about it here.

@aulbach aulbach closed this as completed Dec 3, 2019
@casyalex
Copy link

@evilebottnawi

Hi, I met the same issue. and i create the test repo.

test repo

@alexander-akait
Copy link
Member

@casyalex please remove uglifyjs-webpack-plugin and migrate on terser-webpack-plugin@2

@casyalex
Copy link

casyalex commented Mar 11, 2020

@evilebottnawi
I commit upgrade terser-webpack-plugin to v2.3.5 at test repo, still no luck. And I downgrade to v1.1.0, it works..

@casyalex
Copy link

It happens when >=v1.4.0.

1.4.0 (2019-07-31)
Features
generate higher quality SourceMaps (#109) (9d777f0)

@alexander-akait
Copy link
Member

I will look at that tomorrow, thanks for the issue

@jrwpatterson
Copy link

@evilebottnawi an solutions to this? I have the same issue..

@casyalex
Copy link

My solution is use old version.

@amifor-wordschatz
Copy link

@evilebottnawi,
I have the same problem - there is no sourcesContent field in sourcemap. Although, if I specify in your function minify (minify.js), as it was before
"terserOptions.sourceMap = {
       content: inputSourceMap,
  }; " everything works well.
Maybe this problem can be solved by adding plugin's initialization parameter, depending on the value of which initialize terserOptions.sourceMap?

@CrossMountain
Copy link

I'm sorry, we invested yesterday some hours to find out, what's not working.
For example, we tested it with 2.1, by using minimizer: [new TerserPlugin()],, but same effect. We tried to turn off caching. And some more ideas. All ideas didn't change the outcome - see above.
What we didn't tried is to look, if the problem comes from terser itself. But because we had a solution for our problem and the project has no problem with a little bit longer code we decided to keep it currently as it is.
Eventually we will come back to this problem next year - no promise. But if, I promise to write about it here.

Can you share how to fix?

@CrossMountain
Copy link

@aulbach

@deepanshushukla
Copy link

Is this problem resolved properly ?
I am facing it in the electron-forge app which is using webpack .
turning off minification doesn't look good as it increases the bundle size unnecessarily.

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

7 participants