parcel: @parcel/transformer-typescript-types: Got unexpected undefined
š bug report
I have been following the ābuilding a libraryā instructions in Parcel. When adding my "types" property in package.json, I get an error message when running parcel build.
š Configuration (.babelrc, package.json, cli command)
package.json:
{
"name": "@jvanderen1/unstated-next",
"version": "1.0.0",
"description": "Up-to-date version of everyone's favorite state management library unstated-next",
"repository": {
"type": "git",
"url": "https://github.com/jvanderen1/unstated-next"
},
"license": "MIT",
"author": "<livetoscout@gmail.com>",
"sideEffects": false,
"main": "dist/unstated-next.cjs.js",
"module": "dist/unstated-next.esm.js",
"types": "dist/types.d.ts",
"source": "src/index.ts",
"scripts": {
"build": "npm run clean:dist && parcel build",
"clean": "npm run clean:dist && npm run clean:types && npm run clean:node-modules",
"clean:dist": "rm -rf dist/",
"clean:node-modules": "rm -rf node_modules/",
"clean:types": "tsc --build --clean",
"clean-install": "npm run clean && npm install",
"dev": "parcel example/index.html",
"lint": "eslint './'",
"lint:fix": "npm run lint -- --fix",
"prepare": "husky install",
"pretty": "prettier --check './'",
"pretty:fix": "prettier --write './'",
"types-check": "tsc --skipLibCheck --noEmit"
},
"devDependencies": {
"@parcel/transformer-typescript-types": "^2.0.0-rc.0",
"@swc/cli": "^0.1.49",
"@swc/core": "^1.2.80",
"@types/node": "^16.7.1",
"@types/react": "latest",
"@types/react-dom": "latest",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^7.0.1",
"lint-staged": "^11.1.2",
"parcel": "^2.0.0-beta.3.1",
"prettier": "^2.3.2",
"prop-types": "latest",
"react-dom": "latest",
"ts-node": "^10.2.1",
"typescript": "^4.3.5"
},
"peerDependencies": {
"prop-types": ">= 15.5.0",
"react": ">= 16.8.0"
}
}
š¤ Expected Behavior
The parcel build command works with type definitions in dist/types.d.ts.
šÆ Current Behavior
An error is thrown instead:
@parcel/transformer-typescript-types: Got unexpected undefined
Error: Got unexpected undefined
at nullthrows (/Users/jvanderen1/git-projects/unstated-next/node_modules/nullthrows/nullthrows.js:7:15)
at TSModuleGraph.propagate (/Users/jvanderen1/git-projects/unstated-next/node_modules/@parcel/transformer-typescript-types/lib/TSModuleGraph.js:265:48)
at shake (/Users/jvanderen1/git-projects/unstated-next/node_modules/@parcel/transformer-typescript-types/lib/shake.js:42:35)
at /Users/jvanderen1/git-projects/unstated-next/node_modules/@parcel/transformer-typescript-types/lib/TSTypesTransformer.js:138:33
at transformation (/Users/jvanderen1/git-projects/unstated-next/node_modules/typescript/lib/typescript.js:102910:24)
at transformRoot (/Users/jvanderen1/git-projects/unstated-next/node_modules/typescript/lib/typescript.js:102937:82)
at Object.transformNodes (/Users/jvanderen1/git-projects/unstated-next/node_modules/typescript/lib/typescript.js:102921:78)
at emitDeclarationFileOrBundle (/Users/jvanderen1/git-projects/unstated-next/node_modules/typescript/lib/typescript.js:103653:43)
at emitSourceFileOrBundle (/Users/jvanderen1/git-projects/unstated-next/node_modules/typescript/lib/typescript.js:103556:13)
at forEachEmittedFile (/Users/jvanderen1/git-projects/unstated-next/node_modules/typescript/lib/typescript.js:103264:30)
š Possible Solution
When attaching a debugger to parcel build, I noticed the following exception being thrown:
After creating an empty .npmrc file in my project, I ran parcel build with the debugger again and received this exception:
š Your Environment
| Software | Version(s) |
|---|---|
| Parcel | ^2.0.0-beta.3.1 |
| Node | 16.6.2 |
| npm/Yarn | 7.20.3 |
| Operating System | macOS 11.5.1 |
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 19 (7 by maintainers)
Minimal reproduction:
Iām experiencing the same issue with these dependences:
Is there a solution to fix it?