Skip to content

@ngtools/webpack fails when using "*" as tsconfig paths alias #3441

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
chrisfitz opened this issue Dec 6, 2016 · 7 comments
Closed

@ngtools/webpack fails when using "*" as tsconfig paths alias #3441

chrisfitz opened this issue Dec 6, 2016 · 7 comments
Labels
effort2: medium (days) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity2: inconvenient type: bug/fix

Comments

@chrisfitz
Copy link
Contributor

chrisfitz commented Dec 6, 2016

Please provide us with the following information:

OS?

macOS Sierra

Versions.

angular-cli: 1.0.0-beta.22-1
node: 6.6.0
os: darwin x64
@ngtools/webpack: 1.1.9

Repro steps.

  • Create a new project with ng new project
  • Open the src/tsconfig.json and add the following to compilerOptions:
"paths": {
  "*": [
    "*",
    "path/to/other/dir/*"
  ]
}

The log given by the failure.

$ ng serve
** NG Live Development Server is running on http://localhost:4200. **
Hash: dc480c594a2365ced8eb
Time: 3517ms
chunk    {0} styles.bundle.js, styles.bundle.map (styles) 28 bytes {2} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.map (main) 40 bytes [initial] [rendered]
chunk    {2} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in multi main
Module not found: Error: Recursion in resolving
Stack:
  resolve: (/path/to/project) webpack-dev-server/client?http://localhost:4200/
  new-resolve: (/path/to/project) webpack-dev-server/client?http://localhost:4200/
  parsed-resolve: (/path/to/project) webpack-dev-server/client?http://localhost:4200/ module
  described-resolve: (/path/to/project) webpack-dev-server/client?http://localhost:4200/ module
  resolve: (/path/to/project) webpack-dev-server/client?http://localhost:4200/ module
  new-resolve: (/path/to/project) webpack-dev-server/client?http://localhost:4200/ module
  parsed-resolve: (/path/to/project) webpack-dev-server/client?http://localhost:4200/ module
 @ multi main

ERROR in multi main
Module not found: Error: Recursion in resolving
Stack:
  resolve: (/path/to/project) /path/to/project/src/main.ts
  new-resolve: (/path/to/project) /path/to/project/src/main.ts
  parsed-resolve: (/path/to/project) /path/to/project/src/main.ts
  described-resolve: (/path/to/project) /path/to/project/src/main.ts
  resolve: (/path/to/project) /path/to/project/src/main.ts
 @ multi main

ERROR in multi styles
Module not found: Error: Recursion in resolving
Stack:
  resolve: (/path/to/project) /path/to/project/src/styles.css
  new-resolve: (/path/to/project) /path/to/project/src/styles.css
  parsed-resolve: (/path/to/project) /path/to/project/src/styles.css
  described-resolve: (/path/to/project) /path/to/project/src/styles.css
  resolve: (/path/to/project) /path/to/project/src/styles.css
 @ multi styles

ERROR in   Error: Child compilation failed:
  Entry module not found: Error: Recursion in resolving
  Stack:
    resolve: (/path/to/project) /path/to/project/src/index.html
    new-resolve: (/path/to/project) /path/to/project/src/index.html
    parsed-resolve: (/path/to/project) /path/to/project/src/index.html
    described-resolve: (/path/to/project) /path/to/project/src/index.html
    resolve: (/path/to/project) /path/to/project/src/index.html:
  Error: Recursion in resolving
  Stack:
    resolve: (/path/to/project) /path/to/project/src/index.html
    new-resolve: (/path/to/project) /path/to/project/src/index.html
    parsed-resolve: (/path/to/project) /path/to/project/src/index.html
    described-resolve: (/path/to/project) /path/to/project/src/index.html
    resolve: (/path/to/project) /path/to/project/src/index.html

  - compiler.js:76
    [angular-cli]/[html-webpack-plugin]/lib/compiler.js:76:16

  - Compiler.js:279 Compiler.<anonymous>
    [angular-cli]/[webpack]/lib/Compiler.js:279:10

  - Compiler.js:474
    [angular-cli]/[webpack]/lib/Compiler.js:474:13

  - Tapable.js:102 next
    [angular-cli]/[tapable]/lib/Tapable.js:102:11

  - CachePlugin.js:61 Compiler.<anonymous>
    [angular-cli]/[webpack]/lib/CachePlugin.js:61:4

  - Tapable.js:106 Compiler.applyPluginsAsyncSeries
    [angular-cli]/[tapable]/lib/Tapable.js:106:13

  - Compiler.js:471 Compiler.<anonymous>
    [angular-cli]/[webpack]/lib/Compiler.js:471:10

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [angular-cli]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:626 Compilation.<anonymous>
    [angular-cli]/[webpack]/lib/Compilation.js:626:18

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [angular-cli]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:617 Compilation.<anonymous>
    [angular-cli]/[webpack]/lib/Compilation.js:617:10

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [angular-cli]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:612 Compilation.<anonymous>
    [angular-cli]/[webpack]/lib/Compilation.js:612:9

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [angular-cli]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:608 Compilation.<anonymous>
    [angular-cli]/[webpack]/lib/Compilation.js:608:8

  - Tapable.js:95 Compilation.applyPluginsAsyncSeries
    [angular-cli]/[tapable]/lib/Tapable.js:95:46

  - Compilation.js:554 Compilation.seal
    [angular-cli]/[webpack]/lib/Compilation.js:554:7

  - Compiler.js:468 Compiler.<anonymous>
    [angular-cli]/[webpack]/lib/Compiler.js:468:16

  - Tapable.js:189
    [angular-cli]/[tapable]/lib/Tapable.js:189:11

  - Compilation.js:452 Compilation.<anonymous>
    [angular-cli]/[webpack]/lib/Compilation.js:452:10

  - Compilation.js:347 Compilation.errorAndCallback
    [angular-cli]/[webpack]/lib/Compilation.js:347:3

  - Compilation.js:364 Compilation.<anonymous>
    [angular-cli]/[webpack]/lib/Compilation.js:364:11

  - NormalModuleFactory.js:40 onDoneResolving
    [angular-cli]/[webpack]/lib/NormalModuleFactory.js:40:20

  - NormalModuleFactory.js:117
    [angular-cli]/[webpack]/lib/NormalModuleFactory.js:117:20

  - async.js:726
    [angular-cli]/[webpack]/[async]/lib/async.js:726:13

  - async.js:52
    [angular-cli]/[webpack]/[async]/lib/async.js:52:16

  - async.js:241 done
    [angular-cli]/[webpack]/[async]/lib/async.js:241:17

  - async.js:44
    [angular-cli]/[webpack]/[async]/lib/async.js:44:16

  - async.js:723
    [angular-cli]/[webpack]/[async]/lib/async.js:723:17

  - async.js:167
    [angular-cli]/[webpack]/[async]/lib/async.js:167:37

  - NormalModuleFactory.js:112
    [angular-cli]/[webpack]/lib/NormalModuleFactory.js:112:22

  - Resolver.js:64 onResolved
    [angular-cli]/[enhanced-resolve]/lib/Resolver.js:64:18

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Resolver.js:121 innerCallback
    [angular-cli]/[enhanced-resolve]/lib/Resolver.js:121:19

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Tapable.js:247
    [angular-cli]/[tapable]/lib/Tapable.js:247:15

  - UnsafeCachePlugin.js:37
    [angular-cli]/[enhanced-resolve]/lib/UnsafeCachePlugin.js:37:19

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Resolver.js:121 innerCallback
    [angular-cli]/[enhanced-resolve]/lib/Resolver.js:121:19

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Tapable.js:247
    [angular-cli]/[tapable]/lib/Tapable.js:247:15

  - Resolver.js:121 innerCallback
    [angular-cli]/[enhanced-resolve]/lib/Resolver.js:121:19

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Tapable.js:247
    [angular-cli]/[tapable]/lib/Tapable.js:247:15

  - DescriptionFilePlugin.js:41
    [angular-cli]/[enhanced-resolve]/lib/DescriptionFilePlugin.js:41:20

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Resolver.js:121 innerCallback
    [angular-cli]/[enhanced-resolve]/lib/Resolver.js:121:19

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

  - Tapable.js:247
    [angular-cli]/[tapable]/lib/Tapable.js:247:15

  - paths-plugin.ts:102
    /Users/chrisfitz/Projects/angular-cli/packages/@ngtools/webpack/src/paths-plugin.ts:102:24

  - createInnerCallback.js:31 loggingCallbackWrapper
    [angular-cli]/[enhanced-resolve]/lib/createInnerCallback.js:31:19

Mention any other details that might be useful.

  • If I try adding a node_modules directory as an alternative, the ng serve command will hang and become unresponsive.

Using this:

"paths": {
  "*": [
    "*",
    "path/to/other/dir/node_modules/*"
  ]
}

Results with webpack hanging with this output:

$ ng serve
** NG Live Development Server is running on http://localhost:4200. **
 10% building modules 2/2 modules 0 active

However, occasionally I'll get a memory error:

 10% building modules 1/1 modules 0 active
<--- Last few GCs --->

    7033 ms: Mark-sweep 1379.9 (1398.3) -> 1379.4 (1399.3) MB, 113.4 / 0.0 ms [allocation failure] [GC in old space requested].
    7152 ms: Mark-sweep 1379.4 (1399.3) -> 1379.4 (1399.3) MB, 119.1 / 0.0 ms [allocation failure] [GC in old space requested].
    7272 ms: Mark-sweep 1379.4 (1399.3) -> 1379.1 (1398.3) MB, 119.5 / 0.0 ms [last resort gc].
    7396 ms: Mark-sweep 1379.1 (1398.3) -> 1379.1 (1398.3) MB, 124.7 / 0.0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2eddae7cfb51 <JS Object>
    1: DoJoin(aka DoJoin) [native array.js:~129] [pc=0x10650145bdee] (this=0x2eddae704381 <undefined>,w=0x29dc02989251 <JS Array[865]>,x=865,N=0x2eddae7043c1 <true>,J=0x26be00889cb1 <String[3]\: \n  >,I=0x2eddae7b46e1 <JS Function ConvertToString (SharedFunctionInfo 0x2eddae752dc9)>)
    2: Join(aka Join) [native array.js:180] [pc=0x1065007e82d2] (this=0x2eddae704381 <undefined>,w=0x29dc0298925...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/Users/chrisfitz/.nvm/versions/node/v6.6.0/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/chrisfitz/.nvm/versions/node/v6.6.0/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/chrisfitz/.nvm/versions/node/v6.6.0/bin/node]
 4: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/chrisfitz/.nvm/versions/node/v6.6.0/bin/node]
 5: v8::internal::Runtime_StringBuilderJoin(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/chrisfitz/.nvm/versions/node/v6.6.0/bin/node]
 6: 0x1065005092a7
 7: 0x10650145bdee
Abort trap: 6
  • I have tried using @ngtools/webpack in a custom webpack configuration with the same results.
  • Using tsc to compile the project works as expected.
@chrisnicola
Copy link

Just ran into this and was having issues all day with it. Ended up getting things working by changing my baseUrl fortunately I only have one * alias. God help anyone who has more though.

@filipesilva
Copy link
Contributor

Closing as outdated. If this still happens, please let me know.

@chrisfitz
Copy link
Contributor Author

Hey filipesilva, this still does occur and there's an open pull request that should fix the issue, but hasn't been reviewed yet.

@filipesilva
Copy link
Contributor

@chrisfitz thanks for letting me know, that Pr is still awaiting review. I'll reopen this.

@QuentinFchx
Copy link

QuentinFchx commented Aug 10, 2017

I'm having the same issue with the AotPlugin.
Shall I provide more info? If the PR fixes the issue, is it going to be merged any time soon?

EDIT: just saw the 1.3.0 release. It fixes the issue on my side... sorry 😊

@filipesilva
Copy link
Contributor

Fixed by #7250.

@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort2: medium (days) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity2: inconvenient type: bug/fix
Projects
None yet
5 participants