parcel icon indicating copy to clipboard operation
parcel copied to clipboard

Glob pattern entries not working

Open traed opened this issue 3 years ago • 1 comments

🐛 bug report

In Parcel 1 we could specify entries like this:

const config = {
  entries: [
    "./target-*/script.js,",
    "./target-*/style.scss"
  ],
  ...
};

... if we had one directory called target-1 and another called target-2 parcel would place the bundles in sub directories in the dist directory automatically. This doesn't seem to work anymore, it produces an error.

🎛 Configuration (.babelrc, package.json, cli command)

const config = {
  entries: [
    "./target-*/script.js,",
    "./target-*/style.scss",
  ],
  defaultConfig: '@parcel/config-default',
  defaultTargetOptions: {
    distDir: "./path/to/dist"
  }
};

const bundler = new Parcel(config);
await bundler.run();

🤔 Expected Behavior

Bundle the files included in target-1 to ./path/to/dist/target-1 and the files in target-2 to ./path/to/dist/target-2.

😯 Current Behavior

  {
    origin: '@parcel/namer-default',
    message: 'Bundle group cannot have more than one entry bundle of the same type',
    name: 'AssertionError',
    stack: 'AssertionError [ERR_ASSERTION]: Bundle group cannot have more than one entry bundle of the same type\n' +
      '    at Object.name (/.../node_modules/@parcel/namer-default/lib/DefaultNamer.js:82:29)\n' +
      '    at BundlerRunner.nameBundle (/.../node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:355:39)\n' +
      '    at /.../node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:331:50\n' +
      '    at Array.map (<anonymous>)\n' +
      '    at BundlerRunner.nameBundles (/.../node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:331:31)\n' +
      '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
      '    at async BundlerRunner.bundle (/.../node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:286:5)\n' +
      '    at async RequestTracker.runRequest (/.../@parcel/core/lib/RequestTracker.js:724:20)\n' +
      '    at async Object.run (/.../node_modules/@parcel/core/lib/requests/ParcelBuildRequest.js:62:7)\n' +
      '    at async RequestTracker.runRequest (/.../node_modules/@parcel/core/lib/RequestTracker.js:724:20)',
    codeFrames: undefined
  }

💁 Possible Solution

Fix the glob pattern recognition of sub directories or provide documentation for an alternate approach.

🌍 Your Environment

Software Version(s)
Parcel 2.1.1
Node 16.13.0
npm 8.1
Operating System macOS 12.1

traed avatar Jan 11 '22 16:01 traed

Ping

traed avatar Jul 11 '22 06:07 traed

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

github-actions[bot] avatar Jul 07 '23 00:07 github-actions[bot]