Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with multiple source globs #9713

Open
rmmh opened this issue May 11, 2024 · 0 comments
Open

Build fails with multiple source globs #9713

rmmh opened this issue May 11, 2024 · 0 comments

Comments

@rmmh
Copy link

rmmh commented May 11, 2024

馃悰 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant