parcel icon indicating copy to clipboard operation
parcel copied to clipboard

Error: Cannot read property 'hashReferences' of undefined

Open kevincox opened this issue 4 years ago • 48 comments

🐛 bug report

When adding a synchronous dependency I get the following error:

 🚨 Build failed.
Error: Cannot read property 'hashReferences' of undefined
TypeError: Cannot read property 'hashReferences' of undefined
    at getBundlesIncludedInHash (/builds/kevincox/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:455:47)
    at getBundlesIncludedInHash (/builds/kevincox/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:459:24)
    at getBundlesIncludedInHash (/builds/kevincox/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:459:24)
    at assignComplexNameHashes (/builds/kevincox/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:447:27)
    at PackagerRunner.writeBundles (/builds/kevincox/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:101:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)

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

All the state can be see in https://gitlab.com/kevincox/playerone/-/merge_requests/1.

In that PR I attempt to remove the workaround (using async imports) and you can see that it fails to build.

🤔 Expected Behavior

The build should work as intended.

💁 Possible Solution

This may be related to the fact that this library is imported from two places. The current graph looks like this (when experiencing the bug).

  • main.js
    • sync ga.js
    • async options.js
  • options.js
    • sync ga.js
Software Version(s)
Parcel 2.0.0-nightly.113
Node v13.8.0
npm 6.13.6
Operating System Linux

kevincox avatar Feb 16 '20 11:02 kevincox

Could you try again with the latest parcel@nightly release? The hashing system was recently overhauled.

mischnic avatar Feb 16 '20 11:02 mischnic

Same issue.

% npx parcel --version
2.0.0-nightly.113
% npx parcel build --no-cache -- src/index.pug
🚨 Build failed.
Error: Cannot read property 'hashReferences' of undefined
TypeError: Cannot read property 'hashReferences' of undefined
    at getBundlesIncludedInHash (/home/kevincox/p/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:455:47)
    at getBundlesIncludedInHash (/home/kevincox/p/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:459:7)
    at getBundlesIncludedInHash (/home/kevincox/p/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:459:7)
    at assignComplexNameHashes (/home/kevincox/p/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:447:31)
    at PackagerRunner.writeBundles (/home/kevincox/p/playerone/node_modules/@parcel/core/lib/PackagerRunner.js:101:5)
    at async Parcel.build (/home/kevincox/p/playerone/node_modules/@parcel/core/lib/Parcel.js:376:7)
    at async Parcel.run (/home/kevincox/p/playerone/node_modules/@parcel/core/lib/Parcel.js:253:18)
    at async Command.run (/home/kevincox/p/playerone/node_modules/parcel/lib/cli.js:190:7)

kevincox avatar Feb 16 '20 12:02 kevincox

This error happens practically if not every time you change a configuration property from the package.json or elsewhere. To fix it most of the time just deleting the cache folder seems to fix it for me. Not sure why it's doing that for you because you have the --no-cache flag.

Banou26 avatar Feb 19 '20 13:02 Banou26

To be honest I've been in the habit of removing the cache after every build as it seems to cause a lot of issues. So cache definitely isn't the problem here.

kevincox avatar Feb 19 '20 14:02 kevincox

Thanks for having an easily reproducible example @kevincox! I've opened a PR that I believe should solve this issue. Temporarily, it looks like building with --no-scope-hoist resolves the issue until a fix is merged.

padmaia avatar Feb 20 '20 02:02 padmaia

@Banou26 I think what you are referring to may be fixed by #4189, so keep an eye out on that one.

padmaia avatar Feb 20 '20 03:02 padmaia

I think I'm getting this error when my package.json has an invalid "main" field. Though I'm not sure what parcel considers valid. I'm just pointing my main at "main": "dist/index.html" which doesn't work while "main": "index.html" which unfortunately overwrites my real main file does complete a build.

× Build failed.
Error: Cannot read property 'hashReferences' of undefined
TypeError: Cannot read property 'hashReferences' of undefined
    at getBundlesIncludedInHash (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\@parcel\core\lib\PackagerRunner.js:490:47)
    at getBundlesIncludedInHash (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\@parcel\core\lib\PackagerRunner.js:494:7)
    at getBundlesIncludedInHash (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\@parcel\core\lib\PackagerRunner.js:494:7)
    at assignComplexNameHashes (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\@parcel\core\lib\PackagerRunner.js:482:31)
    at PackagerRunner.writeBundles (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\@parcel\core\lib\PackagerRunner.js:110:5)
    at async Parcel.build (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\@parcel\core\lib\Parcel.js:375:7)
    at async Parcel.run (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\@parcel\core\lib\Parcel.js:250:18)
    at async Command.run (C:\Users\yuv\Downloads\gfloyd-backup\gh-website\node_modules\parcel\lib\cli.js:155:7)

ubershmekel avatar Jun 02 '20 11:06 ubershmekel

I was getting this error on parcel@next (2.0.0-beta.1) using the --dist-dir flag on something like parcel build ./src/index.html --dist-dir=build, but not on parcel@nightly (2.0.0-nightly.322)

brettinternet avatar Jul 05 '20 19:07 brettinternet

Can someone else confirm that this is fixed?

mischnic avatar Jul 06 '20 08:07 mischnic

I'm receiving the error when when two builds in a monorepo share the default cache location -- in this case the cache dir is at the root of the repository.

If add --cache-dir=./.parcel-cache to the builds, I can work around the issue.

ross-pfahler avatar Jul 08 '20 17:07 ross-pfahler

Can someone else confirm that this is fixed?

In the beta I have the same problem. In the version 2.0.0-nightly.358 it works fine.

schlagi123 avatar Aug 06 '20 16:08 schlagi123

I'm on 2.0.0-beta.1 and just encountered the issue in my bitbucket pipeline build

I have a similar structure as @ross-pfahler (monorepo with two packages build built by parcel at the same time)

Haven't tried 2.0.0-nigthly.3658 though

RPDeshaies avatar Aug 06 '20 17:08 RPDeshaies

I'm getting this error with 2.0.0-nightly.366. EDIT: --no-scope-hoist solves the problem for me.

In my case it happens when I try to import a file using a named pipeline, e.g. import css from 'bundle-text:./style.css', and only when I try to build a JS target. When referencing the JS file from HTML, the error does not occur.

cifkao avatar Aug 15 '20 17:08 cifkao

It would be great to at least display a more informative error message (showing which bundle is referenced that is not found).

cifkao avatar Aug 15 '20 17:08 cifkao

In my case it happens when I try to import a file using a named pipeline, e.g. import css from 'bundle-text:./style.css', and only when I try to build a JS target. When referencing the JS file from HTML, the error does not occur.

Can you reproduce this consistently? Could you provide a full code sample?

It would be great to at least display a more informative error message (showing which bundle is referenced that is not found).

We should rather fix the bug itself....

mischnic avatar Aug 15 '20 19:08 mischnic

Can you reproduce this consistently? Could you provide a full code sample?

Sure: https://gist.github.com/cifkao/badeda38164e362a147b571053920520

parcel serve index.html works fine (the CSS file contents get printed onto the console), but parcel build index.js fails with this error.

cifkao avatar Aug 15 '20 20:08 cifkao

At least in @cifkao's example, this is caused by inline bundles not being processed (as they shouldn't) https://github.com/parcel-bundler/parcel/blob/64ebc3757a7c36432d55ee4d791e96e30dab242f/packages/core/core/src/PackagerRunner.js#L116 so bundleInfoMap[someInlineBundle.id] is undefiend. But they are still listed in the hashReferences of their parent bundles: https://github.com/parcel-bundler/parcel/blob/64ebc3757a7c36432d55ee4d791e96e30dab242f/packages/core/core/src/PackagerRunner.js#L658 and then bundleInfoMap[someInlineBundle.id].hashReferences fails. I'm not quite sure if they should just be skipped or handled in some other way.

mischnic avatar Aug 17 '20 10:08 mischnic

I also get this error now too, but with JS instead of CSS.

What seems to have triggered it for me is using ES6 static imports from inside an ES6 dynamic import which I had also imported in the document itself.

The following minimal example reproduces:

{edit} as a gist: https://gist.github.com/dgkimpton/278657a777eb898075b9551ff38606c2

package.json

{
 "name": "parcel-test",
 "version": "1.0.0",
 "scripts": {
  "assemble": "parcel build index.html"
 },
 "devDependencies": {
  "parcel": "^2.0.0-nightly.372"
 }
}

index.html

<!DOCTYPE html>
<html>
<body>
	<script type="module">
		import { something } from './othermodule.mjs';
		document.addEventListener('load', () => {
			something();
			import('./module.mjs').then((m) => m.doStuff());
		});
	</script>
</body>
</html>

module.mjs

import { something } from './othermodule.mjs';

export function doStuff() {
	something();
}

othermodule.mjs

export function something() {
	console.warn('hmmm');
}
Software Version(s)
Parcel [email protected]
Node v14.4.0
npm 6.14.5
Operating System Windows 10/git bash

npm run assemble

� Build failed.
Error: Cannot read property 'hashReferences' of undefined
TypeError: Cannot read property 'hashReferences' of undefined
    at getBundlesIncludedInHash (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:529:47)
    at getBundlesIncludedInHash (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:533:7)
    at getBundlesIncludedInHash (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:533:7)
    at assignComplexNameHashes (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:521:31)
    at PackagerRunner.writeBundles (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:112:5)
    at async Parcel.build (E:\code\web\parcel-error\node_modules\@parcel\core\lib\Parcel.js:398:7)
    at async Parcel.run (E:\code\web\parcel-error\node_modules\@parcel\core\lib\Parcel.js:273:18)
    at async Command.run (E:\code\web\parcel-error\node_modules\parcel\lib\cli.js:234:7)

dgkimpton avatar Aug 20 '20 21:08 dgkimpton

I also get this error now too, but with JS instead of CSS.

What seems to have triggered it for me is using ES6 static imports from inside an ES6 dynamic import which I had also imported in the document itself.

The following minimal example reproduces:

{edit} as a gist: https://gist.github.com/dgkimpton/278657a777eb898075b9551ff38606c2

package.json

{
 "name": "parcel-test",
 "version": "1.0.0",
 "scripts": {
  "assemble": "parcel build index.html"
 },
 "devDependencies": {
  "parcel": "^2.0.0-nightly.372"
 }
}

index.html

<!DOCTYPE html>
<html>
<body>
	<script type="module">
		import { something } from './othermodule.mjs';
		document.addEventListener('load', () => {
			something();
			import('./module.mjs').then((m) => m.doStuff());
		});
	</script>
</body>
</html>

module.mjs

import { something } from './othermodule.mjs';

export function doStuff() {
	something();
}

othermodule.mjs

export function something() {
	console.warn('hmmm');
}

Software Version(s) Parcel [email protected] Node v14.4.0 npm 6.14.5 Operating System Windows 10/git bash

npm run assemble

� Build failed.
Error: Cannot read property 'hashReferences' of undefined
TypeError: Cannot read property 'hashReferences' of undefined
    at getBundlesIncludedInHash (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:529:47)
    at getBundlesIncludedInHash (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:533:7)
    at getBundlesIncludedInHash (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:533:7)
    at assignComplexNameHashes (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:521:31)
    at PackagerRunner.writeBundles (E:\code\web\parcel-error\node_modules\@parcel\core\lib\PackagerRunner.js:112:5)
    at async Parcel.build (E:\code\web\parcel-error\node_modules\@parcel\core\lib\Parcel.js:398:7)
    at async Parcel.run (E:\code\web\parcel-error\node_modules\@parcel\core\lib\Parcel.js:273:18)
    at async Command.run (E:\code\web\parcel-error\node_modules\parcel\lib\cli.js:234:7)

Yep this my problem too, i think we can't use ES6 Export/Import in Parcel. Feels Bad. Do you have any solution for this stuff?

SpeedySH avatar Aug 25 '20 08:08 SpeedySH

Also bumping this as an issue I am experiencing. Seems to be when main is unset in package.json?

EDIT: Latest nightly is working

mrchickenburger avatar Aug 30 '20 10:08 mrchickenburger

I got this issue as well with a recent nightly (2.0.0-nightly.428).

parcel build src/index.html --dist-dir ./dist --public-url=$PUBLIC_PATH --cache-dir ./.parcel-cache --detailed-report
🚨 Build failed.
Error: Cannot read property 'hashReferences' of undefined
TypeError: Cannot read property 'hashReferences' of undefined
    at getBundlesIncludedInHash (/Users/ibaratz/GitHub2/unified-shell/node_modules/@parcel/core/lib/PackagerRunner.js:671:47)
    at getBundlesIncludedInHash (/Users/ibaratz/GitHub2/unified-shell/node_modules/@parcel/core/lib/PackagerRunner.js:675:7)
    at assignComplexNameHashes (/Users/ibaratz/GitHub2/unified-shell/node_modules/@parcel/core/lib/PackagerRunner.js:663:31)
    at PackagerRunner.writeBundles (/Users/ibaratz/GitHub2/unified-shell/node_modules/@parcel/core/lib/PackagerRunner.js:224:5)
    at async Parcel.build (/Users/ibaratz/GitHub2/unified-shell/node_modules/@parcel/core/lib/Parcel.js:584:7)
    at async Parcel.run (/Users/ibaratz/GitHub2/unified-shell/node_modules/@parcel/core/lib/Parcel.js:459:18)
    at async Command.run (/Users/ibaratz/GitHub2/unified-shell/node_modules/parcel/lib/cli.js:352:7)

cc @ross-pfahler

ittaibaratz avatar Oct 23 '20 14:10 ittaibaratz

@ittaibaratz Are you using import foo from 'bundle-text:./something'; or import foo from 'data-url:./something'; (like here)? Or inline script tags with imports? Just trying to verify that there are not even more situations where this occurs...

mischnic avatar Oct 23 '20 14:10 mischnic

@ittaibaratz Are you using import foo from 'bundle-text:./something'; or import foo from 'data-url:./something'; (like here)? Or inline script tags with imports? Just trying to verify that there are not even more situations where this occurs...

We have import SomeSVG from 'url:path/to/image.svg';

Note the issue is very intermittent, and clearing the cache folder and re-running the build gets rid of it.

ittaibaratz avatar Oct 23 '20 14:10 ittaibaratz

I have exact same error with lates nightly build (2.0.0-nightly.443)

$ parcel build src/index.html --dist-dir=public/dist --public-url=/dist/ --log-level=verbose
🚨 Build failed.
Error: Cannot read property 'hashReferences' of undefined
TypeError: Cannot read property 'hashReferences' of undefined
    at getBundlesIncludedInHash (/Volumes/Work/testomato.com/node_modules/@parcel/core/lib/PackagerRunner.js:671:47)
    at getBundlesIncludedInHash (/Volumes/Work/testomato.com/node_modules/@parcel/core/lib/PackagerRunner.js:675:7)
    at assignComplexNameHashes (/Volumes/Work/testomato.com/node_modules/@parcel/core/lib/PackagerRunner.js:663:31)
    at PackagerRunner.writeBundles (/Volumes/Work/testomato.com/node_modules/@parcel/core/lib/PackagerRunner.js:224:5)
    at async Parcel._build (/Volumes/Work/testomato.com/node_modules/@parcel/core/lib/Parcel.js:617:7)
    at async Parcel.run (/Volumes/Work/testomato.com/node_modules/@parcel/core/lib/Parcel.js:487:18)
    at async Command.run (/Volumes/Work/testomato.com/node_modules/parcel/lib/cli.js:361:7)

solved with --no-scope-hoist param build works well.

OzzyCzech avatar Nov 10 '20 20:11 OzzyCzech

hey @mischnic -- in case you want another example, here is an easy repro of a similar problem: https://github.com/ross-pfahler/parcel-2-demos/pull/5. Steps are in PR body.

ross-pfahler avatar Nov 16 '20 17:11 ross-pfahler

I personally get this bug every time I recompile the stylesheets (PostCSS + SugarSS). Clearing the cache after every change has been the only thing that works, but this isn't ideal.

toastal avatar Nov 30 '20 07:11 toastal

Also seeing this specifically with PostCSS + SugarSS

spro avatar Dec 12 '20 06:12 spro

I just encountered this (on 2.0.0-nightly.573+31f431d9) and the --no-scope-hoist suggestion fixed it, although I am not clear what introduced it. I am importing svg's, which is possibly related? 🤷

jeffpeck10x avatar Feb 11 '21 01:02 jeffpeck10x

Another reproduction:

<script type="module">
  import * as b from "./b.js";
  console.log(b);
</script>
<script src="./a.js" type="module"></script>
// a.js
import * as b from "./b.js";
console.log(b);

// b.js
export const a = 1;

mischnic avatar Feb 25 '21 19:02 mischnic

If building for ESM there is no solution or workaround :( Meanwhile the issue got one year old 🎉

artemjackson avatar Feb 26 '21 15:02 artemjackson

I have a build where src/navbar.tsx is the entry point. This gets compiled to dist/navbar.js. I was getting the hashReferences error.

I had in my package.json:

{
  "main": "./dist/navbar.js",
}

When I remove the main: property from my package.json, the error goes away and my bundle works correctly (without --no-cache and --no-scope-hoist). Same error when using module: Hopefully this information might be of use.

GrantAtStreamba avatar Jun 16 '21 01:06 GrantAtStreamba

I can't reproduce with @mischnic's case in the latest nightly anymore. @GrantAtStreamba what version of Parcel are you using and do you have any more details on what could reproduce it?

devongovett avatar Jul 09 '21 06:07 devongovett

Going to close this since it seems to be working now. If you manage to reproduce it still, please let us know.

devongovett avatar Jul 25 '21 22:07 devongovett

The original case is still present https://gitlab.com/kevincox/playerone/-/merge_requests/1. I have rebased the example against Parcel 2.0.0.

I have also found a new case on Parcel 2.0.0 that worked previously. https://gitlab.com/kevincox/playerone/-/merge_requests/65 which appears to be triggered by this import https://gitlab.com/kevincox/playerone/-/blob/72879318ae5db83cb3174871e50b281c297a5b95/src/a/options.ts#L1

kevincox avatar Oct 14 '21 12:10 kevincox

Also experiencing this issue when trying to workaround https://github.com/parcel-bundler/parcel/issues/7609 by using bundle-text: instead :(

🚨 Build failed.

Error: Cannot read properties of undefined (reading 'hashReferences')

  TypeError: Cannot read properties of undefined (reading 'hashReferences')
  at getBundlesIncludedInHash ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/requests/WriteBundlesRequest.js:147:47)
  at getBundlesIncludedInHash ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/requests/WriteBundlesRequest.js:151:7)
  at assignComplexNameHashes ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/requests/WriteBundlesRequest.js:140:105)
  at Object.run ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/requests/WriteBundlesRequest.js:115:5)
  at async RequestTracker.runRequest ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/RequestTracker.js:725:20)
  at async Object.run ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/requests/ParcelBuildRequest.js:74:20)
  at async RequestTracker.runRequest ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/RequestTracker.js:725:20)
  at async Parcel._build ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/Parcel.js:397:11)
  at async Parcel.run ([project_dir]/.yarn/cache/@parcel-core-npm-2.2.1-62c0c81716-f06b61c184.zip/node_modules/@parcel/core/lib/Parcel.js:276:18)
  at async run ([project_dir]/.yarn/cache/parcel-npm-2.2.1-088c07d8bf-081fdc011a.zip/node_modules/parcel/lib/cli.js:374:7)

danieltroger avatar Jan 31 '22 16:01 danieltroger

For me, falling back to fs.readFileSync worked as an ugly workaround :)

danieltroger avatar Jan 31 '22 16:01 danieltroger

Another confirmation for bundle-text: causing the problem. It used to work for me in 2.3.2, but upon upgrading to 2.5.0 I'm hitting this issue

Stvad avatar Apr 29 '22 01:04 Stvad

For me falling back on fs does not work, as I actually want Parcel to process imports in the CSS first =\
https://github.com/shoonia/parcel-transformer-css-to-string/issues/6 does not work for similar reasons =\

Stvad avatar Apr 29 '22 02:04 Stvad

Ah interestingly - it only happens in watch mode but not for build, with following configurations. will check what is causing the difference:

	"build": "parcel build source/manifest.json --no-content-hash --no-source-maps --dist-dir distribution --no-cache --detailed-report 0",
	"watch": "parcel watch source/manifest.json --dist-dir distribution --no-cache --no-hmr",

Stvad avatar Apr 29 '22 02:04 Stvad

so removing --no-hmr seems to have resolved this for me 🤷‍♂️

Stvad avatar Apr 29 '22 02:04 Stvad

But if I were to remove --no-content-hash from the build command, I start hitting this issue in the build command 🙈

Stvad avatar May 08 '22 22:05 Stvad

Running into the same issue during parcel build. --no-content-hash fixes it.

calclavia avatar May 20 '22 16:05 calclavia

Same issue parcel watch works fine, parcel build fails.

  • I'm using the web-extension config
  • I am using 'bundle-text:' import at one place

--no-content-hash helped.


[Jul 11, 2022] Update:

The above doesn't really work. It makes the build command finish execution without errors, but the resulting build turns out to be broken. The issue is with the code surrounding the bundle-text: import. The other (normal) import in the file doesn't seem to work and I get a runtime error:
Cannot find module '81IKK' (The latter I guess is just a hashed name of a module from node_modules)

everdimension avatar Jul 04 '22 11:07 everdimension

Has anyone been able to circumvent the issue? Because the --no-content-hash solution, as stated by @everdimension , doesn't really work.

avalanche1 avatar Jul 19 '22 18:07 avalanche1

@everdimension @avalanche1 I think you may be hitting another bug - see #8071

Stvad avatar Jul 19 '22 18:07 Stvad

@everdimension @avalanche1 I think you may be hitting another bug - see #8071

For reference, a workaround in the linked issue can be found in this comment. I've also outlines that solution below.

As mentioned in everdimension's comment, adding --no-content-hash removes the build error but introduces a runtime error Cannot find module '#####'. The solution is to specify --no-content-hash and then also disable code splitting by adding the following to your package.json file:

  "@parcel/bundler-default": {
    "minBundles": 10000000,
    "minBundleSize": 3000,
    "maxParallelRequests": 20
  }

Keep in mind that this solution removes code-splitting so you will end up with larger individual files. If you're developing a web extension this is generally not an issue since the files are loaded locally anyways. However, Firefox does have a hard limit of 4MB per file ([1], [2]), which could prevent this solution from working on the Firefox Addons site.

mark-monteiro avatar Aug 29 '22 21:08 mark-monteiro

@everdimension @avalanche1 I think you may be hitting another bug - see #8071

For reference, a workaround in the linked issue can be found in this comment. I've also outlined that solution below.

As mentioned in everdimension's comment, adding --no-content-hash removes the build error but introduces a runtime error Cannot find module '#####'. The solution is to specify --no-content-hash and then also disable code splitting by adding the following to your package.json file:

  "@parcel/bundler-default": {
    "minBundles": 10000000,
    "minBundleSize": 3000,
    "maxParallelRequests": 20
  }

Keep in mind that this solution removes code-splitting so you will end up with larger individual files. If you're developing a web extension this is generally not an issue since the files are loaded locally anyways. However, Firefox does have a hard limit of 4MB per file ([1], [2]), which could prevent this solution from working on the Firefox Addons site.

Again, this is all outlined in various comments in the linked issue (#8071), which may the better place to track progress on a fix for this problem.

mark-monteiro avatar Aug 29 '22 21:08 mark-monteiro

@mischnic Will this get priority? Jumping through the hoops just to make the basic f-nality work is distressing.

avalanche1 avatar Sep 04 '22 13:09 avalanche1