Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 37075c8

Browse files
committed
fix __static var on windows (fixes #248)
1 parent dd957e7 commit 37075c8

File tree

5 files changed

+4
-83
lines changed

5 files changed

+4
-83
lines changed

template/.electron-vue/webpack.main.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let mainConfig = {
6565
if (process.env.NODE_ENV !== 'production') {
6666
mainConfig.plugins.push(
6767
new webpack.DefinePlugin({
68-
'__static': `"${path.join(__dirname, '../static')}"`
68+
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
6969
})
7070
)
7171
}

template/.electron-vue/webpack.renderer.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ let rendererConfig = {
136136
if (process.env.NODE_ENV !== 'production') {
137137
rendererConfig.plugins.push(
138138
new webpack.DefinePlugin({
139-
'__static': `"${path.join(__dirname, '../static')}"`
139+
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
140140
})
141141
)
142142
}

template/src/index.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<div id="app"></div>
1515
<!-- Set `__static` path to static files in production -->
1616
<script>
17-
if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static')
17+
if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
1818
</script>
1919

2020
<!-- webpack builds are automatically injected -->

template/src/main/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { app, BrowserWindow } from 'electron'{{#if_eq eslintConfig 'airbnb'}} //
99
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
1010
*/
1111
if (process.env.NODE_ENV !== 'development') {
12-
global.__static = require('path').join(__dirname, '/static'){{#if_eq eslintConfig 'airbnb'}} // eslint-disable-line{{/if_eq}}
12+
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\'){{#if_eq eslintConfig 'airbnb'}} // eslint-disable-line{{/if_eq}}
1313
}
1414

1515
let mainWindow

yarn.lock

-79
This file was deleted.

0 commit comments

Comments
 (0)