Skip to content

Commit 98376a0

Browse files
committed
fix: __static is not defined in production for main
Close electron-userland/electron-webpack-quick-start#2
1 parent e7d5c78 commit 98376a0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/electron-webpack/electron-builder.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ files:
1111
from: "dist/renderer"
1212
-
1313
from: "dist/renderer-dll"
14+
extraResources:
1415
-
1516
from: static
1617
to: static

packages/electron-webpack/src/targets/MainTarget.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from "path"
2-
import { BannerPlugin } from "webpack"
2+
import { BannerPlugin, DefinePlugin } from "webpack"
33
import { WebpackConfigurator } from "../main"
44
import { getFirstExistingFile } from "../util"
55
import { BaseTarget, configureFileLoader } from "./BaseTarget"
@@ -28,6 +28,10 @@ export class MainTarget extends BaseTarget {
2828
await BaseTarget.prototype.configurePlugins.call(this, configurator)
2929

3030
if (configurator.isProduction) {
31+
configurator.plugins.push(new DefinePlugin({
32+
__static: `process.resourcesPath + "/static"`
33+
}))
34+
3135
// do not add for main dev (to avoid adding to hot update chunks), our main-hmr install it
3236
configurator.plugins.push(new BannerPlugin({
3337
banner: 'require("source-map-support/source-map-support.js").install();',

0 commit comments

Comments
 (0)