Coder Social home page Coder Social logo

Comments (2)

jbrantly avatar jbrantly commented on May 18, 2024

Hey thanks for doing all of the hard work on this! Sorry for the delay in implementing it. This is published in v0.3.2.

from ts-loader.

schlaup avatar schlaup commented on May 18, 2024

Ok, thanks, I just discovered an additional problem:

Typescript places its own "//# sourceMappingURL=SomeFile.ts" in the JavaScript output.

So the bundle.js files ends up with multiple "# sourceMappingURL" declarations. (Of course, only the last "# sourceMappingURL=bundle.js.map" is valid)

It seems that Chrome does not care, but other tools do. (For example "NPM source-map-support")

The solution is to remove the redundant and incorrect "sourceMappingURL" declaration.

I added another line:

if (options.sourceMap) {
    var sourceFilename = loaderUtils.getRemainingRequest(this);
    var current = loaderUtils.getCurrentRequest(this);
    sourceMap = JSON.parse(output.outputFiles[0].text);
    sourceMap.sources = [sourceFilename];
    sourceMap.file = current;
    sourceMap.sourcesContent = [contents];
    contents = output.outputFiles[1].text;

This line here:

    contents = contents.replace("# sourceMappingURL=", " ");
}

This solves the problem.

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.