-
Notifications
You must be signed in to change notification settings - Fork 32
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
Adding Electron Support #433
Conversation
return compiler; | ||
// for some reason the MultiCompiler type doesn't include hooks, even though they are clearly defined on the | ||
// object coming back. | ||
interface MultiCompilerWithHooks extends webpack.MultiCompiler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to do this?
const onDemandBtr = new OnDemandBtr({ | ||
buildTimeRenderOptions: btrOptions, | ||
scope: libraryName, | ||
base, | ||
compiler, | ||
entries: config.entry ? Object.keys(config.entry) : [], | ||
compiler: compiler.compilers[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to pass in electron compiler to BTR. Realistically, probably no reason to pass anything to BTR in this case...
src/main.ts
Outdated
} | ||
|
||
if (args.target === 'electron') { | ||
args.base = `.${args.base}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're using electron, the base path can't be absolute and must be relative.
@@ -119,6 +119,7 @@ | |||
"css-loader": "1.0.1", | |||
"css-url-relative-plugin": "1.0.0", | |||
"cssnano": "4.1.7", | |||
"electron": "10.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding electron
as a dep here so you dont need to install it separately on every app. In the future, we'll look into how to conditionally install deps like puppetteer and electron.
@@ -24,7 +24,7 @@ function webpackConfig(args: any): webpack.Configuration { | |||
const experimental = args.experimental || {}; | |||
const isExperimentalSpeed = !!experimental.speed; | |||
const singleBundle = args.singleBundle || isExperimentalSpeed; | |||
const base = args.base || '/'; | |||
const base = args.target === 'electron' ? './' : args.base || '/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Electron target does not support a base URL
@@ -33,7 +33,7 @@ All rights reserved | |||
|
|||
function webpackConfig(args: any): webpack.Configuration { | |||
const basePath = process.cwd(); | |||
const base = args.base || '/'; | |||
const base = args.target === 'electron' ? './' : args.base || '/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Electron target does not support a base URL
Type: feature
The following has been addressed in the PR:
prettier
Description:
Adding Electron target. This is largely based on https://github.com/matt-gadd/cli-build-app/tree/electron-support.
Resolves #356