Skip to content

JIT compiler is trying to resolve expression #8307

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
dklmuc opened this issue Nov 2, 2017 · 5 comments
Closed

JIT compiler is trying to resolve expression #8307

dklmuc opened this issue Nov 2, 2017 · 5 comments
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity3: broken

Comments

@dklmuc
Copy link

dklmuc commented Nov 2, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Angular CLI: 1.5.0
Node: 6.9.5
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: 3.8.1

Repro steps.

create new project
add environment variable
change app.component to:

import { Component } from '@angular/core';
// environment
import { environment } from '../environments/environment';

export function createMetaData(e: Object): Object {
	return {
		selector: 'app-root',
		templateUrl: environment['test'] ? './app.component.html' : './app.component.html',
		styleUrls: ['./app.component.css']
	};
}

@Component(createMetaData(environment))
export class AppComponent {
	title = 'app';
}

The log given by the failure.

ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve ' environment['test'] ? './app.component.html' : './app.component.html'' in 'D:\angular5\src\app'
resolve ' environment['test'] ? './app.component.html' : './app.component.html'' in 'D:\angular5\src\app'
  Parsed request is a module
  using description file: D:\angular5\package.json (relative path: ./src/app)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: D:\angular5\package.json (relative path: ./src/app)
    resolve as module
      D:\angular5\src\app\node_modules doesn't exist or is not a directory
      D:\angular5\src\node_modules doesn't exist or is not a directory
      D:\node_modules doesn't exist or is not a directory
      looking for modules in D:\angular5\node_modules
        using description file: D:\angular5\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\angular5\package.json (relative path: ./node_modules)
          using description file: D:\angular5\package.json (relative path: ./node_modules/ environment['test'] )
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\node_modules\ environment['test']  doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\node_modules\ environment['test'] .ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\node_modules\ environment['test'] .js doesn't exist
            as directory
              D:\angular5\node_modules\ environment['test']  doesn't exist
      looking for modules in D:\node_modules
        No description file found
        Field 'browser' doesn't contain a valid alias configuration
        No description file found
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          D:\node_modules\ environment['test']  doesn't exist
        .ts
          Field 'browser' doesn't contain a valid alias configuration
          D:\node_modules\ environment['test'] .ts doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          D:\node_modules\ environment['test'] .js doesn't exist
        as directory
          D:\node_modules\ environment['test']  doesn't exist
      looking for modules in D:\angular5\node_modules
        using description file: D:\angular5\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\angular5\package.json (relative path: ./node_modules)
          using description file: D:\angular5\package.json (relative path: ./node_modules/ environment['test'] )
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\node_modules\ environment['test']  doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\node_modules\ environment['test'] .ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\node_modules\ environment['test'] .js doesn't exist
            as directory
              D:\angular5\node_modules\ environment['test']  doesn't exist
      looking for modules in D:\angular5\src
        using description file: D:\angular5\package.json (relative path: ./src)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\angular5\package.json (relative path: ./src)
          using description file: D:\angular5\package.json (relative path: ./src/ environment['test'] )
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\src\ environment['test']  doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\src\ environment['test'] .ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\src\ environment['test'] .js doesn't exist
            as directory
              D:\angular5\src\ environment['test']  doesn't exist
      looking for modules in D:\angular5\src
        using description file: D:\angular5\package.json (relative path: ./src)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\angular5\package.json (relative path: ./src)
          using description file: D:\angular5\package.json (relative path: ./src/ environment['test'] )
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\src\ environment['test']  doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\src\ environment['test'] .ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\angular5\src\ environment['test'] .js doesn't exist
            as directory
              D:\angular5\src\ environment['test']  doesn't exist
[D:\angular5\src\app\node_modules]
[D:\angular5\src\node_modules]
[D:\node_modules]
[D:\node_modules\package.json]
[D:\angular5\node_modules\ environment['test'] ]
[D:\node_modules\ environment['test'] \package.json]
[D:\angular5\node_modules\ environment['test'] .ts]
[D:\node_modules\ environment['test'] ]
[D:\angular5\node_modules\ environment['test'] .js]
[D:\node_modules\ environment['test'] .ts]
[D:\angular5\node_modules\ environment['test'] ]
[D:\node_modules\ environment['test'] .js]
[D:\node_modules\ environment['test'] ]
[D:\angular5\node_modules\ environment['test'] ]
[D:\angular5\node_modules\ environment['test'] .ts]
[D:\angular5\node_modules\ environment['test'] .js]
[D:\angular5\node_modules\ environment['test'] ]
[D:\angular5\src\ environment['test'] ]
[D:\angular5\src\ environment['test'] .ts]
[D:\angular5\src\ environment['test'] .js]
[D:\angular5\src\ environment['test'] ]
[D:\angular5\src\ environment['test'] ]
[D:\angular5\src\ environment['test'] .ts]
[D:\angular5\src\ environment['test'] .js]
[D:\angular5\src\ environment['test'] ]
 @ ./src/app/app.component.ts 13:18-99
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

Desired functionality.

Should use the right template like in AoT

Mention any other details that might be useful.

Was working fine until upgrade to ng5/CLI 1.5

@Brocco Brocco added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity3: broken labels Nov 3, 2017
@dklmuc
Copy link
Author

dklmuc commented Dec 8, 2017

Some further investigations:

  • Problem still exists with CLI v1.6.0 and angular v5.1.0
  • still working with CLI v1.6.0 and angular v4.4.6
  • thanks to tests from @mlc-mlapis it's working with a non-CLI angular v5

So I really have no clue what's going on here... If it's a CLI issue, an angular issue or if it's due to changes of a dependency.

@dcatoday
Copy link

dcatoday commented Jan 5, 2018

I'm seeing the same errors when trying to import components from an in house component library.

@mgechev
Copy link
Member

mgechev commented Dec 22, 2018

Are you still able to reproduce this issue with the latest version?

@mgechev
Copy link
Member

mgechev commented Dec 24, 2018

Closing it due to inactivity. If the problem is still reproducible with the latest CLI, please open a new issue following the template and sharing a minimal demo where we can reproduce it. Thank you! :)

@mgechev mgechev closed this as completed Dec 24, 2018
@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity3: broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants