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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to use path for icon in preload.js options #257

Open
pjmdesi opened this issue May 10, 2024 · 0 comments
Open

unable to use path for icon in preload.js options #257

pjmdesi opened this issue May 10, 2024 · 0 comments

Comments

@pjmdesi
Copy link

pjmdesi commented May 10, 2024

Problem Description

I get the following error while building (for either dev or production) when trying to use node:path in the preload.js file to load the icon for the custom title bar.

Module build failed: UnhandledSchemeError: Reading from "node:path" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default.

Steps to Reproduce

My code:

const path = require('node:path');

const options = {
	backgroundColor: TitlebarColor.fromHex('#0000'),
	itemBackgroundColor: TitlebarColor.fromHex('#08162F'),
	containerOverflow: 'hidden',
	icon: path.join(__dirname, 'assets/images', 'app-icon.png'),
};

Expected Behavior

Icon loads properly in production. Using path does not break the plugin.

Current Behavior

Using path in the icon directory option breaks the plugin and makes builds fail

Additional Information

Using the following hard-coded object property works for dev, but not production:
icon: './assets/images/window-icon.png',
I'm using React BTW.

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