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

Vendor source map files not included in /dist #706

Closed
jasonswett opened this Issue May 10, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@jasonswett

jasonswett commented May 10, 2016

I'm using Angular CLI version 0.0.39 on Mac OS.

When I run ng serve using a proxy (ng serve --proxy http://localhost:3000) I see a bunch of requests come across like this:

GET /vendor/reflect-metadata/Reflect.js.map 404 507.868 ms - -
GET /vendor/@angular/platform-browser-dynamic/index.js.map 404 209.116 ms - -
GET /vendor/@angular/platform-browser-dynamic/platform_browser_dynamic.js.map 404 341.069 ms - -
GET /vendor/@angular/compiler/index.js.map 404 436.576 ms - -

At port 3000 I have a Rails server running with /public symlinked to /dist, meaning a URL like http://localhost:3000/vendor/reflect-metadata/Reflect.js will load the actual Reflect.js from my Angular project. The Reflect.js.map file is genuinely not in dist next to Reflect.js, and navigating to http://localhost:3000/vendor/reflect-metadata/Reflect.js.map gives a 404.

I would imagine that either Angular should not be looking for these map files or the map files should be present. It's also entirely possible that I'm misinterpreting the situation because a lot of this stuff is new to me.

@thorstenschaefer

This comment has been minimized.

thorstenschaefer commented May 11, 2016

I had the same issues with Angular CLI Beta on MacOS. However, it only shows up in Safari, not in Chrome. Here's a screenshot of the error console from both browsers for the same project:
http://imgur.com/JwmLsJw

@jasonswett

This comment has been minimized.

jasonswett commented May 11, 2016

@thorstenschaefer I'm experiencing the same thing. Did you figure out a way around it or are you still experiencing the problem?

@thorstenschaefer

This comment has been minimized.

thorstenschaefer commented May 11, 2016

I just ignored the issue for now and use Chrome for testing. Even when using Safari, everything should work normally despite the 404 errors - I just find it disturbing as "real" error messages might get overlooked. Let's see if someone from the CLI team can tell whether this is a CLI issue or caused in some other Angular part.

@jasonswett

This comment has been minimized.

jasonswett commented May 11, 2016

Well it's definitely a genuine problem. I have my Angular app sitting on a backend server which receives all these bad file requests, meaning my logs get polluted with huge amounts of meaningless noise. Fortunately it only happens in dev and not prod, but still I'd like it not to happen at all.

@filipesilva

This comment has been minimized.

Member

filipesilva commented May 11, 2016

You can configure the CLI to copy over the map files in the vendorNpmFiles entry in angular-cli-build.js.

These were left out intentionally (by me) because they slowed down the dev rebuilds. I'd like to revisit this though, with a better and faster way of building the project.

@jasonswett

This comment has been minimized.

jasonswett commented May 11, 2016

Ooh, awesome! This might be a dumb question but how exactly would I do that? I'm guessing it would end in *.js.map but I don't know what would go ahead of that.

@jasonswett

This comment has been minimized.

jasonswett commented May 12, 2016

This is how I fixed it. I'm not sure if this is the absolute best way.

/* global require, module */

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
      'zone.js/dist/*.{js,js.map}',
      'es6-shim/es6-shim.js',
      'reflect-metadata/*.{js,js.map}',
      'rxjs/**/*.{js,js.map}',
      '@angular/**/*.{js,js.map}'
    ]
  });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment