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.
Hello,
there is the same problem with the overlay contained in @angular2-material/core/overlay/overlay.js
@vincentpalita Not only the overlay is affected. Generally all distribution files are affected.
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' {} +
@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?
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: https://github.com/systemjs/builder/issues/606 & https://github.com/systemjs/builder/issues/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.
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.
@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 :)
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.
@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.
@vincentpalita In SystemJS Builder v0.15.19, you're able to properly disable the sourceMaps validation / tracing. See systemjs/builder#612
@DevVersion, yes I saw that yesterday :)
Thank you for telling me though!
Have a good one!
@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.
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
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.
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
The SystemJS builder issue where it was throwing on invalid input source maps is resolved in the latest builder release.
@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.
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._
Most helpful comment
Stripping out sourcemap paths works, as per @DevVersion. Quick cmd to do so:
Linux:
FreeBSD/OSX: