Skip to content

On webpack run: "TypeError: Cannot read property 'name' of undefined" #502

Closed

Description

@vandalouze

If transpileOnly is true it works. However this is not a permanent solution.
Webpack builds very long time and the memory of the webpack process increases over 1.5 GB, until node.js ran out of memory. I literally build just a ts file as entry point which contains console.log('abc').

ts-loader: Using /Users/aight8/my-project/node_modules/typescript@2.2.1. This version may or may not be compatible with ts-loader.
ts-loader: Using config file at /Users/aight8/my-project/tsconfig.json

/Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25122
                error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
                                             ^
TypeError: Cannot read property 'name' of undefined
    at mergeSymbol (/Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25122:46)
    at /Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25146:21
    at Map.forEach (native)
    at mergeSymbolTable (/Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25136:20)
    at mergeSymbol (/Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25117:21)
    at /Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25146:21
    at Map.forEach (native)
    at mergeSymbolTable (/Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25136:20)
    at mergeSymbol (/Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25117:21)
    at /Users/aight8/my-project/node_modules/typescript/lib/typescript.js:25146:21

Ts config is currently:

{
    "compilerOptions": {
        "noImplicitAny": false,
        "strictNullChecks": false,
        "moduleResolution": "node",
        "target": "es2017",
        "outDir": "bin",
        "sourceMap": true,
        "module": "commonjs",
        "typeRoots": [
            "node_modules/@types"
        ],
        "pretty": true
    },
    "include": [
        "src"
    ]
}

However I tested various other settings. The error stays the same.

Tested with typescript 2.2.1 and 2.3-nightly

Parallel issue in awesome-typescript-loader: s-panferov/awesome-typescript-loader#395

Activity

  1. johnnyreilly commented on Mar 16, 2017

    @johnnyreilly
    Member

    I've a feeling there are issues with typeRoots - though i forget the specifics...

  2. lbguilherme commented on Apr 23, 2017

    @lbguilherme

    Looks like this was fixed by pull microsoft/TypeScript#15075, issue microsoft/TypeScript#14628. Will be released as TS 2.3.1 soon.

  3. lbguilherme commented on Apr 28, 2017

    @lbguilherme

    2.3.1 was released and still contains the bug, you can use typescript@next. The fix was NOT released, but resides in master for 2.4.0. They really should release this.

  4. Opty1712 commented on Jun 9, 2017

    @Opty1712

    Got same error. Any news?

  5. johnnyreilly commented on Jun 9, 2017

    @johnnyreilly
    Member

    Assuming 2.4 resolved it then hang tight for that. It'll be out soon

  6. johnnyreilly commented on Jun 9, 2017

    @johnnyreilly
    Member

    Oh and you could try making use of the fork-ts-checker-webpack-plugin (see our docs). It should be run with ts-loader in transpile mode and so might not be affected. Worth a try anyway (perf boost either way!)

  7. stale commented on Jan 19, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  8. stale commented on Mar 20, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  9. stale commented on Mar 27, 2019

    @stale

    Closing as stale. Please reopen if you'd like to work on this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions