Skip to content

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

Description

@chrisfitz

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions