🐛 bug report
when building a library that contains react component, parcel works with the build command line, but watch outputs an error:
@parcel/packager-js: Asset was skipped or not found.
AssertionError [ERR_ASSERTION]: Asset was skipped or not found.
at ScopeHoistingPackager.getSymbolResolution
...
also reported here: #7495
🎛 Configuration (.babelrc, package.json, cli command)
no babel config when the bug happens.
Full repro described here: https://github.com/e-krebs/parcel-react-library
important parts of the package.json looks like:
{
// ...
"source": "src/index.ts",
"main": "dist/index.js",
"types": "dist/types.d.ts",
"targets": {
"main": {
"isLibrary": true,
"context": "browser"
}
},
"scripts": {
"build": "parcel build",
"watch": "parcel watch",
},
"devDependencies": {
"@parcel/packager-ts": "^2.2.1",
"@parcel/transformer-typescript-types": "^2.2.1",
"@types/express": "^4.17.13",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11",
"parcel": "^2.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^4.5.5"
},
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"alias": {
"@parcel/transformer-react-refresh-wrap": "./node_modules/@parcel/transformer-react-refresh-wrap"
}
}
and then, the src/index.ts file exports a React component from another file.
🤔 Expected Behavior
parcel watch should not output an error but work (same as parcel build works, actually).
😯 Current Behavior
parcel watch outputs an error (error message on Windows below, but the same happen on linux):
yarn : @parcel/packager-js: Asset was skipped or not found.
At line:1 char:1
+ yarn watch
+ ~~~~~~~~~~
AssertionError [ERR_ASSERTION]: Asset was skipped or not found.
at ScopeHoistingPackager.getSymbolResolution
(C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:732:29)
at C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:836:31
at Array.map (<anonymous>)
at ScopeHoistingPackager.buildAssetPrelude
(C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:835:37)
at ScopeHoistingPackager.buildAsset
(C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:398:48)
at ScopeHoistingPackager.visitAsset
(C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:357:17)
at C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:456:56
at String.replace (<anonymous>)
at ScopeHoistingPackager.buildAsset
(C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:420:19)
at ScopeHoistingPackager.visitAsset
(C:\projects\parcel-react-library\node_modules\@parcel\packager-js\lib\ScopeHoistingPackager.js:357:17)
💁 Possible Solution
a workaround is to use babel (see Code Sample below), but:
- parcel outputs warning when doing so
- it is slower
- it produces a larger bundle
🔦 Context
Just building a library that contains react components. It is for internal use, but it could be a public design system library for example.
💻 Code Sample
https://github.com/e-krebs/parcel-react-library
🌍 Your Environment
| Software |
Version(s) |
| Parcel |
2.2.1 |
| Node |
16.13.0 |
| npm/Yarn |
1.22.5 |
| Operating System |
Windows 10 / Ubuntu in wsl |
🐛 bug report
when building a library that contains react component, parcel works with the
buildcommand line, butwatchoutputs an error:also reported here: #7495
🎛 Configuration (.babelrc, package.json, cli command)
no babel config when the bug happens.
Full repro described here: https://github.com/e-krebs/parcel-react-library
important parts of the
package.jsonlooks like:and then, the
src/index.tsfile exports a React component from another file.🤔 Expected Behavior
parcel watchshould not output an error but work (same asparcel buildworks, actually).😯 Current Behavior
parcel watchoutputs an error (error message on Windows below, but the same happen on linux):💁 Possible Solution
a workaround is to use babel (see Code Sample below), but:
🔦 Context
Just building a library that contains react components. It is for internal use, but it could be a public design system library for example.
💻 Code Sample
https://github.com/e-krebs/parcel-react-library
🌍 Your Environment