8000 Could not resolve [moduleName] relative to [path] for modules ending with "*.js" · Issue #14663 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

Could not resolve [moduleName] relative to [path] for modules ending with "*.js" #14663

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
mgechev opened this issue Feb 23, 2017 · 3 comments
Closed
Labels
area: core Issues related to the framework runtime freq2: medium type: bug/fix
Milestone

Comments

@mgechev
Copy link
Member
mgechev commented Feb 23, 2017

PR here #14664

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

The issue is in @angular/compiler-cli when using AoT and referencing modules which end with .js. For instance:

// ...
import { Wove } from 'aspect.js';

@Wove()
export class NameListService {

  constructor(private http: Http) {}

  get(): Observable<string[]> {
    return this.http.get('assets/data.json')
                    .map((res: Response) => res.json())
                    .catch(this.handleError);
  }
}

Fails with error:

Error: Error encountered resolving symbol values statically. Could not resolve aspect.js relative to .../shared/name-list/name-list.service.ts., resolving symbol NameListService in .../shared/name-list/name-list.service.ts, resolving symbol NameListService in .../app/shared/name-list/name-list.service.ts

The issue is in:

CompilerHost.getCanonicalFileName where the .js from aspect.js is being stripped by the line
m = m.replace(EXT, '');, since it's considered as a relative path.

Expected behavior

There should not be an error.

Minimal reproduction of the problem with instructions

Try to use the @Wove decorator from aspect.js.

  • Angular version: 2.0.X

Angular 2.4 - 4.0.

  • Language: TypeScript

According to microsoft/TypeScript#4595, stripping the file extension is not required because the TypeScript compiler accepts imports with which include extension.

@fahdsaeed
Copy link

i'm getting this error

ERROR in /home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/src/app/dashboard/dashboard.module.ts (5,30): Cannot find module 'angular2-select'.
ERROR in Error: Error encountered resolving symbol values statically. Could not resolve angular2-select relative to /home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/src/app/dashboard/dashboard.module.ts., resolving symbol DashboardModule in /home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/src/app/dashboard/dashboard.module.ts, resolving symbol DashboardModule in /home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/src/app/dashboard/dashboard.module.ts
at Error (native)
at syntaxError (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
at simplifyInContext (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler/bundles/compiler.umd.js:25118:23)
at StaticReflector.simplify (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler/bundles/compiler.umd.js:25130:13)
at StaticReflector.annotations (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler/bundles/compiler.umd.js:24558:41)
at _getNgModuleMetadata (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at /home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@ngtools/webpack/src/plugin.js:207:44)
at _donePromise.Promise.resolve.then.then.then.then.then (/home/kleidyaesara/public_html/aesara-knowledge-reservoir-client/node_modules/@ngtools/webpack/src/plugin.js:443:24)
at process._tickCallback (internal/process/next_tick.js:109:7)

webpack: Failed to compile.

@ngbot ngbot bot added this to the Backlog milestone Jan 23, 2018
@pkozlowski-opensource
Copy link
Member

Sounds like this one can be closed based on #14664 (comment)

@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 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime freq2: medium type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
0