mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 11:56: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({
|
||||
entries: [
|
||||
{ find: '@main', replacement: join(__dirname, '../src/main'), },
|
||||
{ find: '@root', replacement: join(__dirname, '..'), },
|
||||
{ find: '@render', replacement: join(__dirname, '../src/render') },
|
||||
{ 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 主文件
|
||||
*/
|
||||
import '@src/common/patch'
|
||||
import { join } from 'path'
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
import dotenv from 'dotenv'
|
||||
|
@ -1,8 +1,4 @@
|
||||
/**
|
||||
* !!! ensure cwd crrect
|
||||
*/
|
||||
process.chdir(__dirname)
|
||||
|
||||
import '@src/common/patch'
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import fs = require('fs')
|
||||
|
@ -11,8 +11,9 @@
|
||||
"baseUrl": "./",
|
||||
"strict": true,
|
||||
"paths": {
|
||||
"@/*": ["src/render/*"],
|
||||
"@render/*": ["src/render/*"],
|
||||
"@main/*": ["src/main/*"],
|
||||
"@src/*": ["src/*"],
|
||||
"@root/*": ["./*"]
|
||||
},
|
||||
"allowSyntheticDefaultImports": true
|
||||
|
@ -18,7 +18,9 @@ export default defineConfig({
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': join(__dirname, 'src/render'),
|
||||
'@render': join(__dirname, 'src/render'),
|
||||
'@main': join(__dirname, 'src/main'),
|
||||
'@src': join(__dirname, 'src'),
|
||||
'@root': __dirname,
|
||||
},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user