Coder Social home page Coder Social logo

Comments (12)

blakeembrey avatar blakeembrey commented on May 18, 2024

Personally, I think it's expected to be overridden (I don't need to know how as the consumer though) to "just work" as you would have enabled it in Webpack. I see it being a confusing case (and someone thinking it's a bug) if I have webpack's source maps enabled and they don't work.

from ts-loader.

jbrantly avatar jbrantly commented on May 18, 2024

Alrightly! Sounds like this is something we should do then.

from ts-loader.

basarat avatar basarat commented on May 18, 2024

to "just work" as you would have enabled it in Webpack.

I agree. If webpack asks for sourcemaps, they should get sourcemaps 🌹 (irrespective of what they have in tsconfig.json)

from ts-loader.

johnnyreilly avatar johnnyreilly commented on May 18, 2024

Definitely Definitely Definitely! The way I see it it's the same as how the files is (presumably) ignored in favour of what comes out of the require / import statements in code.

from ts-loader.

jbrantly avatar jbrantly commented on May 18, 2024

@basarat @johnnyreilly What about the case where the user has explicitly set sourceMap: false in tsconfig.json but we detect that webpack wants sourcemaps?

from ts-loader.

basarat avatar basarat commented on May 18, 2024

we detect that webpack wants sourcemaps

Give webpack what it wants. Let sourcemaps be a webpack driven thing consistently. Less configuration options to explain.

They will not get sourceMaps unless webpack asks for it and if webpack asks for it they definitely get it.

from ts-loader.

johnnyreilly avatar johnnyreilly commented on May 18, 2024

Agree with @basarat

from ts-loader.

altano avatar altano commented on May 18, 2024

I agree source maps should just work by default for sure, but I'd like to politely strongly disagree on that last point. Sourcemaps are horrible to debug with. It's like trying to debug optimized CPP from source: it just doesn't work. My preferred way to use sourcemaps with webpack is to have the intermediate output be available in the debugger, not the original content.

In the case of ts-loader, having the original tsx file (for example) show up in Chrome is completely worthless. The highlighted line doesn't map to the line that is going to execute and it's impossible to step through the code. On the other end of the spectrum, not having sourcemaps and having to always debug the final bundle is equally annoying. The best thing to have be sourcemapped is the final JS output before bundling. So not the tsx file, but the produced jsx file with the React calls, before it is put into the bundle.

In short, I would love to be able to enable webpack source maps but disable ts-loader sourcemaps, so that I only get a source map from bundle.js to output of ts-loader, not the original files. And I would assume the best way of handling this would be to make it so that sourceMap: false in tsconfig.json turns of ts-loader source-map generation/merging.

from ts-loader.

jbrantly avatar jbrantly commented on May 18, 2024

Thanks for your comments @altano. Actively overriding a user-specified option definitely doesn't sit right with me, and you've provided a use case for why.
.

from ts-loader.

stale avatar stale commented on May 18, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from ts-loader.

stale avatar stale commented on May 18, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from ts-loader.

stale avatar stale commented on May 18, 2024

Closing as stale. Please reopen if you'd like to work on this further.

from ts-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.