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

feat(plugin): Allow integrating more complex render solutions #412

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

LukeHagar
Copy link
Contributor

BREAKING CHANGE: changes renderer plugin to no longer error when renderer build.target is not "chrome?" or "es?".

Hello Everyone!

I am currently working on an adapter for using full stack sveltekit applications in Electron, and my current plan is to use electron-vite coupled with the sveltekit vite plugin to compile the application.

I am currently accomplishing this here using what is essentially a mono repo to build one app and then importing the handler into an express server embedded inside electron and building electron.

My goal is to simplify this using electron-vite and have this be one dev and build command that ends in a fully functional electron application.

This error is currently blocking this implementation and feels like an unnecessary limitation of the platform.

I have converted the error thrown to a warning message that I think accomplishes the same thing in most instances.

I believe that making this change would allow similar full-stack style implementations for other platforms that include a server-side component and can be compiled to node servers like Next.js, etc...

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

@LukeHagar
Copy link
Contributor Author

@alex8088 I patched this locally in node modules and I already have a successful build of the application.

Please let me know if you have any concerns with this.

@alex8088
Copy link
Owner

@LukeHagar
What is the purpose of build.target in your usage scenario? It will be passed to esbuild and is related to HMR. It usually has nothing to do with the final build.

@LukeHagar
Copy link
Contributor Author

My usage is with SvelteKit,

For example here is my root vite.config.js

import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'

export default defineConfig({
    logLevel: 'info',
    plugins: [sveltekit()]
})

and my electron.vite.config.js

import { defineConfig, defineViteConfig } from 'electron-vite';
import config from './vite.config';

export default defineConfig({
	main: defineViteConfig({}),
	preload: defineViteConfig({}),
	renderer: config
});

In my usage all of the config values are coming directly from sveltekit, I am using a sveltekit adapter that compiles the full application into a polka handler, and I am then using that handler inside my electron application

I have patched this error into a warn message locally in my node modules and I have a fully functional application.

image

@LukeHagar
Copy link
Contributor Author

Hey @alex8088,

I just wanted to bump this thread, Do you have any thoughts on what I put above?

@LukeHagar
Copy link
Contributor Author

Hey @alex8088,

Please let me know if there are any concerns here, this PR is currently the only thing blocking this package.

@alex8088
Copy link
Owner

Thanks, i will make some tests for this.

@alex8088 alex8088 merged commit 52fce25 into alex8088:master Feb 23, 2024
@LukeHagar
Copy link
Contributor Author

@alex8088 Thank you for the merge!

Could I ask when the next version release would be?

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

Successfully merging this pull request may close these issues.

2 participants