Merge pull request #237 from electron-vite/dev

bump devDependencies
This commit is contained in:
草鞋没号 2022-08-11 10:58:50 +08:00 committed by GitHub
commit 55106f98fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 62 deletions

View File

@ -15,13 +15,13 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.0.1",
"electron": "^19.0.8",
"electron-builder": "^23.1.0",
"electron": "^20.0.2",
"electron-builder": "^23.3.3",
"typescript": "^4.7.4",
"vite": "^3.0.3",
"vite-plugin-electron": "^0.8.1",
"vite": "^3.0.5",
"vite-plugin-electron": "^0.8.7",
"vue": "^3.2.37",
"vue-tsc": "^0.39.4"
"vue-tsc": "^0.40.1"
},
"env": {
"VITE_DEV_SERVER_HOST": "127.0.0.1",

View File

@ -41,7 +41,6 @@ export default defineConfig({
// https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#electron-renderervite-serve
renderer: {},
}),
renderBuiltUrl(),
],
server: {
host: pkg.env.VITE_DEV_SERVER_HOST,
@ -64,59 +63,3 @@ function withDebug(config: UserConfig): UserConfig {
}
return config
}
// Only worked Vite@3.x #212
function renderBuiltUrl(): Plugin {
// https://github.com/vitejs/vite/blob/main/packages/vite/src/node/constants.ts#L84-L124
const KNOWN_ASSET_TYPES = [
// images
'png',
'jpe?g',
'jfif',
'pjpeg',
'pjp',
'gif',
'svg',
'ico',
'webp',
'avif',
// media
'mp4',
'webm',
'ogg',
'mp3',
'wav',
'flac',
'aac',
// fonts
'woff2?',
'eot',
'ttf',
'otf',
// other
'webmanifest',
'pdf',
'txt'
]
return {
name: 'render-built-url',
config(config) {
config.experimental = {
renderBuiltUrl(filename, type) {
if (
KNOWN_ASSET_TYPES.includes(path.extname(filename).slice(1)) &&
type.hostType === 'js'
) {
// Avoid Vite relative-path assets handling
// https://github.com/vitejs/vite/blob/89dd31cfe228caee358f4032b31fdf943599c842/packages/vite/src/node/build.ts#L838-L875
return { runtime: JSON.stringify(filename) }
}
},
}
},
}
}