Build fails with multiple source globs
rmmh opened this issue Β· comments
Ryan Hitchman commented
π bug report
Building with the new (in canary) feature of package.json source glob patterns breaks in some conditions with custom file types.
π Configuration (.babelrc, package.json, cli command)
parcel@2.0.0-canary.1591, see Code Sample for full repro script.
π€ Expected Behavior
npx parcel build
succeeds.
π― Current Behavior
π¨ Build failed.
Error: Cannot use 'in' operator to search for 'key' in undefined
TypeError: Cannot use 'in' operator to search for 'key' in undefined
at getJSONHighlightLocation (/home/ryan/repro/node_modules/parcel/node_modules/@parcel/diagnostic/lib/diagnostic.js:165:19)
at getJSONSourceLocation (/home/ryan/repro/node_modules/parcel/node_modules/@parcel/diagnostic/lib/diagnostic.js:207:11)
at EntryResolver.resolveEntry (/home/ryan/repro/node_modules/parcel/node_modules/@parcel/core/lib/requests/EntryRequest.js:228:62)
at async Object.run (/home/ryan/repro/node_modules/parcel/node_modules/@parcel/core/lib/requests/EntryRequest.js:57:16)
at async RequestTracker.runRequest (/home/ryan/repro/node_modules/parcel/node_modules/@parcel/core/lib/RequestTracker.js:777:20)
at async AssetGraphBuilder.runEntryRequest
(/home/ryan/repro/node_modules/parcel/node_modules/@parcel/core/lib/requests/AssetGraphRequest.js:344:18)
at async $dad2a694f9c45026$export$2e2bcd8739ae039._runFn
(/home/ryan/repro/node_modules/parcel/node_modules/@parcel/utils/lib/index.js:34004:13)
at async $dad2a694f9c45026$export$2e2bcd8739ae039._next
(/home/ryan/repro/node_modules/parcel/node_modules/@parcel/utils/lib/index.js:33997:9)
π Possible Solution
It seems the multiple source logic from package.json is buggy.
npx parcel build *.html *.tmpl
works.- package.json
"source": ["*.{tmpl.html}"]
works - removing
b.tmpl
works-- building one HTML and one TMPL file.
π¦ Context
I'm using parcel to process HTML templates for another tool to render.
π» Code Sample
tiny repro script:
#!/bin/bash
set -exu
mkdir repro
cd repro
cat > package.json <<EOF
{
"name": "parcel-multi-repro",
"source": [
"*.tmpl",
"*.html"
]
}
EOF
cat > .parcelrc <<EOF
{
"extends": "@parcel/config-default",
"transformers": {
"*.tmpl": [
"@parcel/transformer-posthtml",
"@parcel/transformer-html",
],
},
}
EOF
touch a.tmpl b.tmpl c.html
npm i parcel@2.0.0-canary.1591
npx parcel build
π Your Environment
Software | Version(s) |
---|---|
Parcel | 2.0.0-canary.1591+fcc6b5963 |
Node | v20.12.2 |
npm/Yarn | 10.5.2 |
Operating System | Ubuntu 22.04.4 LTS (x86_64) |