components: release: incorrect sourcemaps

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.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 8
  • Comments: 18 (2 by maintainers)

Commits related to this issue

Most upvoted comments

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' {} +

@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.

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

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

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

@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": "angular-cli@1.0.0-beta.5",
      "dependencies": {
        "systemjs-builder": {
          "version": "0.15.16",
          "from": "systemjs-builder@0.15.16"
        }
      }
    }
  }
}

This allow you to fix a dependency for a module.