Skip to content

ng build --prod fails #4739

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

Closed
ukaaa opened this issue Feb 16, 2017 · 2 comments
Closed

ng build --prod fails #4739

ukaaa opened this issue Feb 16, 2017 · 2 comments

Comments

@ukaaa
Copy link

ukaaa commented Feb 16, 2017

OS?

Window 10

Versions.

@angular/cli: 1.0.0-beta.30
node: 6.9.0
os: win32 x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/compiler-cli: 2.4.7

@typescript: ~2.0.3

Repro steps.

I called ng build --prod. In dev environment it works fine.

The log given by the failure.

WARNING in ./src/$$_gendir/app/app.module.ngfactory.ts
959:29-46 "export 'version' (imported as 'import200') was not found in '../../environments/environment'

ERROR in ./~/angular2-logger/app/core/logger.ts
Module build failed: TypeError: Cannot read property 'text' of undefined
    at Object.getTokenPosOfNode (C:\…\node_modules\typescript\lib\typescript.js:5692:71)
    at IdentifierObject.TokenOrIdentifierObject.getStart (C:\…\node_modules\typescript\lib\typescript.js:53623:23)
    at IdentifierObject.TokenOrIdentifierObject.getText (C:\…\node_modules\typescript\lib\typescript.js:53644:77)
    at refactor.findAstNodes.filter (C:\…\node_modules\@ngtools\webpack\src\loader.js:135:44)
    at Array.filter (native)
    at refactor.findAstNodes.forEach.node (C:\…\node_modules\@ngtools\webpack\src\loader.js:134:14)
    at Array.forEach (native)
    at _removeDecorators (C:\…\node_modules\@ngtools\webpack\src\loader.js:125:10)
    at Promise.resolve.then (C:\…\node_modules\@ngtools\webpack\src\loader.js:295:33)
 @ ./~/angular2-logger/core.js 6:9-37
 @ ./src/$$_gendir/app/app.module.ngfactory.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Mention any other details that might be useful.

It could be interesting to note that my environment files have an additional property called "version", and I refer to the dev environment explicitely in angular-cli.json.

// environment.dev.ts
const version = require('./deploy.json').version;
export const environment = {
  production: false,
  version
};
// environment.prod.ts
const version = require('./deploy.json').version;
export const environment = {
  production: true,
  version
};
// angular-cli.json
"environments": {
  "source": "environments/environment.ts",
  "dev": "environments/environment.dev.ts", // <---
  "prod": "environments/environment.prod.ts"
}
@ukaaa
Copy link
Author

ukaaa commented Feb 16, 2017

Apologies, it seems related to this and e3b48da.

@ukaaa ukaaa closed this as completed Feb 16, 2017
@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant