Skip to content

Source maps issues and typescript 1.8+ incompatibilities. #1266

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

Closed
KirNekrasov opened this issue Jul 1, 2016 · 3 comments
Closed

Source maps issues and typescript 1.8+ incompatibilities. #1266

KirNekrasov opened this issue Jul 1, 2016 · 3 comments
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix

Comments

@KirNekrasov
Copy link

  1. Windows 7
  2. Versions
    angular-cli: 1.0.0-beta8
    node: 6.2.2
    os: win32 x64
    typescript: 1.8.10
    chrome: 51.0.2704.103
  3. Create new app => start the server => F12 in chrome => sources => no .ts files.
  4. I didnt found this in known issues, so, please, add somewhere info, that current angular-cli version has this incompatibility with typescript 1.8. And for those people, who installed (or updated to) typescript 1.8: you should delete "mapRoot": "/" from tsconfig.json and disable method fixSourceMapSources in "node_modules\angular-cli\lib\broccoli\broccoli-typescript.js", this will fix urls to your source maps in compiled .js files.
@filipesilva filipesilva added type: bug/fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Jul 3, 2016
wholladay added a commit to wholladay/angular-cli that referenced this issue Jul 5, 2016
The default mapRoot setting and code generation does not work with typescript 1.8+ as noted in the comments for the "fixSourceMapSources" function in broccoli-typescript.js. I removed the "fixSourceMapSources" function and also removed the default mapRoot setting. This fix was suggested by KirNekrasov in his comments to the bug.

angular#1266
wholladay added a commit to wholladay/angular-cli that referenced this issue Jul 8, 2016
Removed the inputFilePath variable that is no longer needed and was causing lint to fail.

angular#1266
@vchatterji
Copy link

Hi,

Just adding a temporary workaround in case anyone wants to debug while this is fixed.

This is working for me for TypeScript 1.8.10 and Visual Studio Code Version 1.3.0 (1.3.0) Mac.

  • Define a build task:
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "tsc",
    "isShellCommand": true,
    "args": ["-p", "./src"],
    "showOutput": "silent",
    "problemMatcher": "$tsc"
}
  • Define the launch configuration for debug:
        {
            "name": "Launch localhost with sourcemaps",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:4200",
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}/dist",
            "diagnosticLogging": true,
            "userDataDir": "${workspaceRoot}/.vscode/chrome"
        },
  • Check the tsconfig.json file in the /src folder:
{
  "compileOnSave": false,
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "outDir": "../dist/",
    "rootDir": ".",
    "target": "es5",
    "sourceMap": true
  },

  "files": [
    "main.ts",
    "typings.d.ts"
  ]
}
  • Compile the project with ng build:
ng build

=> This will bring .html files and other assets into the dist directory

  • Compile it again with tsc
cd src
tsc

=> This will update the source maps as compiled by TSC without broccoli.

  • Serve the project through http-server
npm install http-server -g
http-server dist -p 4200

Launch the debug config from Visual Studio Code.

Your break points should be hit in your TS files

@filipesilva
Copy link
Contributor

Closed as issue was made obsolete by #1455.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix
Projects
None yet
Development

No branches or pull requests

3 participants