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

release: incorrect sourcemaps #541

Closed
devversion opened this issue May 27, 2016 · 18 comments · Fixed by #636
Closed

release: incorrect sourcemaps #541

devversion opened this issue May 27, 2016 · 18 comments · Fixed by #636
Labels
P2 The issue is important to a large percentage of users, with a workaround
Milestone

Comments

@devversion
Copy link
Member

devversion commented May 27, 2016

In previous releases like alpha.4, the sourcemap paths were correctly resolved in relative to the transpiled file.

This has changed in alpha.5.

//# sourceMappingURL=/usr/local/google/home/jelbourn/material2/tmp/broccoli_type_script_compiler-input_base_path-IydvmmBU.tmp/0/components/slide-toggle/slide-toggle.js.map

Since, the sourcemap paths are not valid anymore, SystemJS is not able to create a bundle of Angular Material 2 components. (applies also to the CLI - uses SystemJS builder as well).

I temporary fixed this, by stripping the souremap paths out of the components.

@vincentpalita
Copy link

Hello,

there is the same problem with the overlay contained in @angular2-material/core/overlay/overlay.js

@devversion
Copy link
Member Author

@vincentpalita Not only the overlay is affected. Generally all distribution files are affected.

@jelbourn jelbourn added this to the alpha.6 milestone May 27, 2016
@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label May 27, 2016
@benjaminkitt
Copy link

Stripping out sourcemap paths works, as per @devversion. Quick cmd to do so:

Linux:

cd ./node_modules/@angular2-material
find . -type f -exec sed -i 's/\/\/# \S*jelbourn\/material2\S*/ /g' {} +

FreeBSD/OSX:

cd ./node_modules/@angular2-material
find . -type f -exec sed -i '' 's/\/\/# \S*jelbourn\/material2\S*/ /g' {} +

@RoxKilly
Copy link

RoxKilly commented May 28, 2016

@benjaminkitt Is there a convenient solution to strip out these strings or fix them -- perhaps by replacing the problematic path with ./ -- automatically on Windows machines?

@vincentpalita
Copy link

vincentpalita commented May 28, 2016

The problem of sourceMap url not being found by systemjs-builder is apparently a bug introduced in its version 0.15.17. Please see the related tickets: systemjs/builder#606 & systemjs/builder#610
If you specify in your package.json that you want to use version below (ie: 0.15.16) it will build fine.

I think that is better to do swtich systemjs-builder version instead of modifying the local code of the @angular2-material module.
Why? --> Because if you use automated builds without versioning your node_modules folder and run a npm install at each run, then you will download back the current alpha.5 version with bad sourcemap urls.

@RoxKilly
Copy link

RoxKilly commented May 28, 2016

Interesting. So when I run npm install, it overwrites what's already installed even if the two versions are the same?

I took your advice and replaced 0.15.18 with 0.15.16 for the time being. Thank you.

@vincentpalita
Copy link

@RoxKilly : If the version of package.json differs with the installed one, it will download the version of package.json in favor of the already installed one.

Glad it helped :)

@ofuangka
Copy link

Just to be clear, the working version of systemjs-builder is 0.15.16, not 0.5.16. I got this to work, but only by updating the angular-cli/package.json. Updating my own application's package.json did not work as npm still downloaded the old version for angular-cli.

@vincentpalita
Copy link

@ofuangka thanks for reporting my typo here :)
I don't use angular-cli, but it sounds strange that you had to change this inside the module's dependencies.

I would recommend to use a npm-shrinkwrap.json as below instead:

{
  "dependencies": {
    "angular-cli": {
      "version": "1.0.0-beta.5",
      "from": "[email protected]",
      "dependencies": {
        "systemjs-builder": {
          "version": "0.15.16",
          "from": "[email protected]"
        }
      }
    }
  }
}

This allow you to fix a dependency for a module.

@devversion
Copy link
Member Author

@vincentpalita In SystemJS Builder v0.15.19, you're able to properly disable the sourceMaps validation / tracing. See systemjs/builder#612

@vincentpalita
Copy link

@devversion, yes I saw that yesterday :)
Thank you for telling me though!
Have a good one!

@jelbourn jelbourn added P2 The issue is important to a large percentage of users, with a workaround and removed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Jun 2, 2016
@vredchenko
Copy link

@benjaminkitt BTW the FreeBSD command for stripping out source map comment lines didn't work for me (OS X 10.11). Instead I used regex search in Sublime: ^.*jelbourn/material2.*\n.

@clarkmalmgren
Copy link

I just added this file to my build process which works really well.

#! /bin/bash
# Workaround for https://github.com/angular/material2/issues/541

if [[ "$OSTYPE" == "darwin"* ]]; then
  find node_modules/\@angular2-material/ -name "*.js" -exec sed -i "" 's/\/\/# sourceMappingURL=.*\//\/\/# sourceMappingURL=/' {} \;
else
  find node_modules/\@angular2-material/ -name "*.js" -exec sed -i 's/\/\/# sourceMappingURL=.*\//\/\/# sourceMappingURL=/' {} \;
fi

@sebasrodriguez
Copy link

The sourcemap fix on systemjs is not working properly. Basically is not sending the sourceMaps option to all the functions that is needed and that causes the build to fail cause on some cases it still looks for the sourcemap. @guybedford already added a fix for this a couple of days ago but hasn't pushed the new version with that new patch.

@shameerkc
Copy link

Facing the same issue here as well... Initially the fix angular/angular-cli#847 seemed like the root cause but the source map issue started popping after the fix as mentioned in angular/angular-cli#847

@guybedford
Copy link

The SystemJS builder issue where it was throwing on invalid input source maps is resolved in the latest builder release.

@netmikey
Copy link

@guybedford Have you managed to make it work?

Just using the most recent SystemJS version (0.19.31 right now) in my package.json and rebuilding with ng build -e prod doesn't seem to fix it, still getting the error.

@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.