mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
fix: ensure process.cwd() correct.
This commit is contained in:
parent
f6f363364d
commit
d5f294cd2a
@ -25,8 +25,10 @@ export default (env = 'production') => {
|
|||||||
}),
|
}),
|
||||||
alias({
|
alias({
|
||||||
entries: [
|
entries: [
|
||||||
{ find: '@main', replacement: join(__dirname, '../src/main'), },
|
{ find: '@render', replacement: join(__dirname, '../src/render') },
|
||||||
{ find: '@root', replacement: join(__dirname, '..'), },
|
{ find: '@main', replacement: join(__dirname, '../src/main') },
|
||||||
|
{ find: '@src', replacement: join(__dirname, '../src') },
|
||||||
|
{ find: '@root', replacement: join(__dirname, '..') },
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
4
src/common/patch.ts
Normal file
4
src/common/patch.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* !!! ensure process.cwd() correct
|
||||||
|
*/
|
||||||
|
process.chdir(__dirname.slice(0, __dirname.lastIndexOf('dist')))
|
@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* electron 主文件
|
* electron 主文件
|
||||||
*/
|
*/
|
||||||
|
import '@src/common/patch'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { app, BrowserWindow } from 'electron'
|
import { app, BrowserWindow } from 'electron'
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
/**
|
import '@src/common/patch'
|
||||||
* !!! ensure cwd crrect
|
|
||||||
*/
|
|
||||||
process.chdir(__dirname)
|
|
||||||
|
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import fs = require('fs')
|
import fs = require('fs')
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/render/*"],
|
"@render/*": ["src/render/*"],
|
||||||
"@main/*": ["src/main/*"],
|
"@main/*": ["src/main/*"],
|
||||||
|
"@src/*": ["src/*"],
|
||||||
"@root/*": ["./*"]
|
"@root/*": ["./*"]
|
||||||
},
|
},
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
|
@ -18,7 +18,9 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': join(__dirname, 'src/render'),
|
'@render': join(__dirname, 'src/render'),
|
||||||
|
'@main': join(__dirname, 'src/main'),
|
||||||
|
'@src': join(__dirname, 'src'),
|
||||||
'@root': __dirname,
|
'@root': __dirname,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user