-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
159 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import path from 'path'; | ||
import webpack from 'webpack'; | ||
import { merge } from 'webpack-merge'; | ||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; | ||
import baseConfig from './webpack.config.base'; | ||
import webpackPaths from './webpack.paths'; | ||
import checkNodeEnv from '../scripts/check-node-env'; | ||
|
||
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's | ||
// at the dev webpack config is not accidentally run in a production environment | ||
if (process.env.NODE_ENV === 'production') { | ||
checkNodeEnv('development'); | ||
} | ||
|
||
const configuration: webpack.Configuration = { | ||
devtool: 'inline-source-map', | ||
|
||
mode: 'development', | ||
|
||
target: 'electron-preload', | ||
|
||
entry: path.join(webpackPaths.srcMainPath, 'preload.ts'), | ||
|
||
output: { | ||
path: webpackPaths.dllPath, | ||
filename: 'preload.js', | ||
}, | ||
|
||
plugins: [ | ||
new BundleAnalyzerPlugin({ | ||
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled', | ||
}), | ||
|
||
/** | ||
* Create global constants which can be configured at compile time. | ||
* | ||
* Useful for allowing different behaviour between development builds and | ||
* release builds | ||
* | ||
* NODE_ENV should be production so that modules do not perform certain | ||
* development checks | ||
* | ||
* By default, use 'development' as NODE_ENV. This can be overriden with | ||
* 'staging', for example, by changing the ENV variables in the npm scripts | ||
*/ | ||
new webpack.EnvironmentPlugin({ | ||
NODE_ENV: 'development', | ||
}), | ||
|
||
new webpack.LoaderOptionsPlugin({ | ||
debug: true, | ||
}), | ||
], | ||
|
||
/** | ||
* Disables webpack processing of __dirname and __filename. | ||
* If you run the bundle in node.js it falls back to these values of node.js. | ||
* https://github.com/webpack/webpack/issues/2010 | ||
*/ | ||
node: { | ||
__dirname: false, | ||
__filename: false, | ||
}, | ||
|
||
watch: true, | ||
}; | ||
|
||
export default merge(baseConfig, configuration); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
declare global { | ||
interface Window { | ||
electron: { | ||
ipcRenderer: { | ||
myPing(): void; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
on(channel: string, func: (...args: any[]) => void): void; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
once(channel: string, func: (...args: any[]) => void): void; | ||
}; | ||
}; | ||
} | ||
} | ||
|
||
export {}; |