Coder Social home page Coder Social logo

Comments (8)

raveclassic avatar raveclassic commented on May 20, 2024

Ran into this issue when tried to disable sourcemaps completely.
Looks like when "sourceMap": false is present in tsconfig, JSON.parse in compiler tries to parse undefined - this is how an error Module build failed: SyntaxError: Unexpected token u appears.

from awesome-typescript-loader.

s-panferov avatar s-panferov commented on May 20, 2024

@raveclassic thanks for your report. I'll fix this.

from awesome-typescript-loader.

raveclassic avatar raveclassic commented on May 20, 2024

@s-panferov Thanks!
Besides could you please investigate into disabling sourcemaps in general?
In my current workflow I use typescript transpiling to es6 and then pass result to babel. Somehow it appeared today that sourcemaps from typescript does not suit anymore to babel and it fails with invalid mapping error when receiving inputSourceMap
Sure it's problem with babel or typescript, but nevertheless I failed trying to disable sourcemapping in awesome-typescript-loader.

TIA

from awesome-typescript-loader.

frapontillo avatar frapontillo commented on May 20, 2024

I have the same issue, and something more with the following configuration:

{
    resolve: {extensions: ['', '.ts', '.js']},
    watch: watch,
    module: {
      preLoaders: [{test: /\.ts$/, exclude: /node_modules/, loaders: ['tslint-loader']}],
      loaders: [{test: /\.ts$/, exclude: /node_modules/, loaders: ['ng-annotate', 'awesome-typescript-loader']}]
    },
    output: {
      filename: 'output.js'
    }
}

With this configuration, the file is generated BUT there are multiple

//# sourceMappingURL=my.typescript.original.file.js.map

directives for each included transpiled module, while in the end there is a

//# sourceMappingURL=output.js.map

as it should be.
This leads to errors while processing the source maps, since all the first maps are never found (are they temporary during the transpilation process?) as only the last one is actually generated.

Then I tried to set ?sourceMap=false to see if the issue could be fixed and I got the same error as the one reported by @nelo112.

This is similar to webpack/webpack#273 and also causes SitePen/remap-istanbul#20.

from awesome-typescript-loader.

s-panferov avatar s-panferov commented on May 20, 2024

All problems with source maps might gone in v0.15.3, please try it.

from awesome-typescript-loader.

krtr avatar krtr commented on May 20, 2024

At 0.15.3 and karma I'm still not getting sourcemaps at all with devtool: 'inline-source-map'.
capture

config:

 {
            resolve: {
                extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
            },
            output: {
                devtoolModuleFilenameTemplate: "../[resource-path]",
                devtoolFallbackModuleFilenameTemplate:"../[resource-path]"
            },
            devtool: 'inline-source-map',
            module: {
                loaders: [
                    {
                        test: /\.tsx?$/,
                        loaders: ['awesome-typescript-loader'],
                    },
                    {
                        test: /\.json?$/,
                        loaders: ['json-loader']
                    }
                ]
            }
           }

tsconfig:

{
  "compilerOptions": {
    "target": "es6",
    "sourceMap": true,
    "jsx": "react",
    "experimentalDecorators": true,
    "experimentalAsyncFunctions": true
  },
  "awesomeTypescriptLoaderOptions": {
    "useBabel": true,
    "useCache": false,
    "emitRequireType": false
  }
}

from awesome-typescript-loader.

frapontillo avatar frapontillo commented on May 20, 2024

@s-panferov I can confirm the fix, thanks!

from awesome-typescript-loader.

anil1712 avatar anil1712 commented on May 20, 2024

How to configure the same for react native?

from awesome-typescript-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.