Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

When I downloaded the Windows release and tried to run the game using the browser, it looks like the FOSSIL plugin is causing a ReferenceError: require is not defined error on start-up. Using a custom code patch for the FOSSIL plugin, I was able to remove the references to require and I was able to get the game to start. Below is a custom patch I made for the FOSSIL plugin.

Additionally, it may be worth looking at this forum post here for more information on the FOSSIL plugin and workarounds for this issue. Good luck!

For any curious, here’s the patch to replace writeNewIndexFile in ./js/plugins/FOSSIL.js:

writeNewIndexFile = function(rawIndexHtml) {
		//next, we take the newIndexHtml and replace 'main.js' with '/plugins/FOSSIL.js'
		rawIndexHtml = rawIndexHtml.replace("main.js", "plugins/FOSSIL.js");

		// Browser-safe: prefer navigating to an in-memory data: URI so no Node fs is required.
		try {
			// Use encodeURIComponent to avoid issues with binary content
			const dataUri = 'data:text/html;charset=utf-8,' + encodeURIComponent(rawIndexHtml);
			// Replace current page with generated HTML. This avoids needing filesystem access.
			window.location.replace(dataUri);
			return;
		} catch (e) {
			// If navigation to data URI fails for any reason, fall back to prompting a download.
			console.warn('FOSSIL: data URI navigation failed, falling back to download.', e);
		}

		// Fallback: create a downloadable blob and trigger a save as "FOSSILindex.html"
		try {
			const blob = new Blob([rawIndexHtml], { type: 'text/html' });
			const url = URL.createObjectURL(blob);
			const a = document.createElement('a');
			a.href = url;
			a.download = 'FOSSILindex.html';
			// required for Firefox
			document.body.appendChild(a);
			a.click();
			a.remove();
			URL.revokeObjectURL(url);
		} catch (err) {
			// Last resort: open in a new tab (some browsers may block popups)
			console.error('FOSSIL: failed to create download for FOSSILindex.html', err);
			const w = window.open();
			if (w) {
				w.document.open();
				w.document.write(rawIndexHtml);
				w.document.close();
			} else {
				alert('FOSSIL: unable to create FOSSILindex.html automatically. Please enable popups or save the page manually.');
			}
		}
	};
(+1)

Thanks for posting this!

FOSSIL is incredibly picky, and is likely the source of a number of other issues I can't explain or solve, but I'm not fluent enough in Javascript to be able to even begin to addressing that sort of thing within the game itself. This is definitely a great resource to have, though. I've had quite a few people asking how to address FOSSIL throwing a fit when they try to launch the game in ways FOSSIL isn't expecting.