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

Update usage in README #198

Open
AgainPsychoX opened this issue Aug 25, 2021 · 1 comment
Open

Update usage in README #198

AgainPsychoX opened this issue Aug 25, 2021 · 1 comment

Comments

@AgainPsychoX
Copy link

Currently usage described in README makes the app fail if building for production (no dev deps).

image

In my opinion, one of following should be applied:

  1. Mention the behaviour for clarity (even while it's close to obvious),
  2. Change the installation to install as regular dependency (no -D/--save-dev)
  3. Introduce dynamic loading example, where the extensions are only installed while in development (maybe using isDev flag from electron-is-dev, or app.isPackaged).

For inspiration, in my codebase I use something like:

app.whenReady().then(async () => {
	if (isDev) {
		const { default: installExtension, REACT_DEVELOPER_TOOLS } = await import('electron-devtools-installer');
		await installExtension(REACT_DEVELOPER_TOOLS);
	}

	createWindow();
	//...
@jrohlandt
Copy link

@AgainPsychoX thanks. I'm using the package based off your example above.

Just out of curiosity: Why do you recommend in step number two to not install the package as a dev dependency? Shouldn't dynamically loading the package only in dev mode prevent any issues in packaged applications? Or is there something else to take into consideration as well?

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

2 participants