Skip to content

ng build -prod 404 on imported items in main.ts #1354

@yentheo

Description

@yentheo

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Windows 10
  2. Versions. Please run ng --version. If there's nothing outputted, please
    run in a Terminal:
    node --version
    And paste the result here.
    node: 5.1.0
    angular-cli: 0.0.39
    angular: 2.0.0-rc.4
    systemjs: 0.19.26
    zone.js: 0.6.12
    os: win32 x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    Create a new angular project with
    > ng new _projectname_
    Add a new TypeScript file in /src/app/
    For example my-service.ts
import { Injectable } from '@angular/core';

@Injectable()
export class MyService { }

import the service in main.ts

import { bootstrap } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { MyProjectAppComponent, environment } from './app/';
import { MyService } from './app/my-service';

var service = new MyService();

if (environment.production) {
  enableProdMode();
}

bootstrap(MyProjectAppComponent);

ng serve runs fine and the app works, ng serve -prod runs fine too but the app doesn't work. I get a 404 on my-service.ts

  1. The log given by the failure. Normally this include a stack trace and some
    more information.
    image

  2. Mention any other details that might be useful.
    I made a stackoverflow question about this too but not a lot of views:
    http://stackoverflow.com/questions/38353014/ng-build-prod-404-on-imported-items-in-main-ts


    Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions