Skip to content

Commit

Permalink
Merge pull request #13 from nodecg/vite-5
Browse files Browse the repository at this point in the history
Add support for Vite 5 and fix dev server assets
  • Loading branch information
Dan-Shields authored Mar 11, 2024
2 parents 2345106 + 8d33f6e commit 4fbdd2b
Show file tree
Hide file tree
Showing 11 changed files with 536 additions and 250 deletions.
8 changes: 7 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export default function viteNodeCGPlugin(pluginConfig: PluginConfig): Plugin {
tags.push(
`<script type="module" src="${dSrvProtocol}://${path.posix.join(
dSrvHost,
'bundles',
bundleName,
'@vite/client'
)}"></script>`
)
Expand Down Expand Up @@ -219,7 +221,7 @@ export default function viteNodeCGPlugin(pluginConfig: PluginConfig): Plugin {
config: (_config, { mode }): UserConfig => {
return {
build: {
manifest: true,
manifest: 'manifest.json',
outDir: 'shared/dist',
rollupOptions: {
input: inputs,
Expand Down Expand Up @@ -276,6 +278,10 @@ export default function viteNodeCGPlugin(pluginConfig: PluginConfig): Plugin {
dSrvHost = `${server.config.server.host ?? 'localhost'}:${
server.config.server.port ?? '5173'
}`

// fix dev server origin
server.config.server.origin = `${dSrvProtocol}://${dSrvHost}`

// dev inject
generateHTMLFiles()
})
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
},
"license": "ISC",
"dependencies": {
"globby": "^13.2.2",
"minimatch": "^6.2.0"
"globby": "^14.0.1",
"minimatch": "^9.0.3"
},
"devDependencies": {
"@types/node": "^18.18.13",
"rollup": "^3.29.4",
"typescript": "^4.9.5",
"vite": "^4.5.0"
"@types/node": "^20.11.25",
"rollup": "^4.12.1",
"typescript": "^5.4.2",
"vite": "^5.1.5"
},
"peerDependencies": {
"vite": "^4.0.4"
}
"vite": "^4.0.4 || ^5.1.5"
},
"packageManager": "[email protected]+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2"
}
Loading

0 comments on commit 4fbdd2b

Please sign in to comment.