Parcel: Parcel v2 - Types field in package.json crash

Created on 30 Oct 2019  ยท  7Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

Build crashes on building react typescript project:

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

https://github.com/lindskogen/parcel-v2-repro

๐Ÿค” Expected Behavior

I expect the code to be bundled.

๐Ÿ˜ฏ Current Behavior

yarn parcel build src/index.ts

๐Ÿšจ Error: Got unexpected undefined
Error: Got unexpected undefined
    at nullthrows (/Users/lindskogen/parcel/node_modules/nullthrows/nullthrows.js:7:15)
    at TSModuleGraph.resolveImport (/Users/lindskogen/parcel/packages/transformers/typescript-types/src/TSModuleGra
ph.js:108:13)
    at resolveImport (/Users/lindskogen/parcel/packages/transformers/typescript-types/src/TSModuleGraph.js:55:29)
    at visitNode (/Users/lindskogen/parcel-repro/node_modules/typescript/lib/typescript.js:67595:23)
    at Object.visitEachChild (/Users/lindskogen/parcel-repro/node_modules/typescript/lib/typescript.js:67761:57)
    at visitEachChild (/Users/lindskogen/parcel/packages/transformers/typescript-types/src/TSModuleGraph.js:67:17)
    at visitNode (/Users/lindskogen/parcel-repro/node_modules/typescript/lib/typescript.js:67595:23)
    at Object.visitEachChild (/Users/lindskogen/parcel-repro/node_modules/typescript/lib/typescript.js:67899:108)
    at TSModuleGraph.visitEachChild [as markUsed] (/Users/lindskogen/parcel/packages/transformers/typescript-types/
src/TSModuleGraph.js:72:10)
    at TSModuleGraph.markUsed [as propagate] (/Users/lindskogen/parcel/packages/transformers/typescript-types/src/T
SModuleGraph.js:171:12)

๐Ÿ’ Possible Solution

Removing the "types" field from package.json makes it work

๐Ÿ’ป Code Sample

https://github.com/lindskogen/parcel-v2-repro

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 2.0.0-alpha.2.1
| Node | v10.17.0
| npm/Yarn | 1.19.1
| Operating System | macOS Catalina (10.15.1)

Bug Confirmed Bug โœจ Parcel 2

Most helpful comment

Thanks so much for the detailed repro! Should be fixed by #3712.

All 7 comments

Thanks so much for the detailed repro! Should be fixed by #3712.

@devongovett Thank you for the fix! I cloned you branch locally and tried it again. Now it worked in my repro but not in my real project.

Could this be an issue with yarn workspaces?

I have updated my repro-repo _(Try saying that five times fast!)_ with a yarn workspaces example that still have this issue!

Thanks I'll take a look.

@lindskogen I think this is a separate issue. We don't support extends in tsconfig yet. If you copy and paste the config from the outer tsconfig in your project into the inner one instead it works. I'll work on supporting extends in a separate PR.

Oh, I didn't know that. Thank you for your time and quick reply!

extends is implemented in #3728.

You're the man! Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Niggler picture Niggler  ยท  3Comments

davidnagli picture davidnagli  ยท  3Comments

humphd picture humphd  ยท  3Comments

dsky1990 picture dsky1990  ยท  3Comments

philipodev picture philipodev  ยท  3Comments