fix: no vite-node in non-dev mode

This commit is contained in:
Eli Bosley
2024-11-05 11:38:40 -05:00
parent da673c3f2b
commit 08f6d6df65
3 changed files with 18 additions and 15 deletions

View File

@@ -21,4 +21,4 @@ dynamicRemoteAccessType="DISABLED"
[upc]
apikey="unupc_fab6ff6ffe51040595c6d9ffb63a353ba16cc2ad7d93f813a2e80a5810"
[connectionStatus]
minigraph="ERROR_RETRYING"
minigraph="PRE_INIT"

View File

@@ -2,8 +2,9 @@
"include": [
"src/**/*",
".eslintrc.ts",
"vite.config.ts"
, "unraid-api-cli.js" ],
"vite.config.ts",
"unraid-api-cli.js"
],
"exclude": [
"node_modules",
"vite.config.ts"

View File

@@ -6,8 +6,7 @@ import { viteStaticCopy } from 'vite-plugin-static-copy';
import nodeResolve from '@rollup/plugin-node-resolve';
import { VitePluginNode } from 'vite-plugin-node';
export default defineConfig(() => {
export default defineConfig(({ mode }) => {
return {
plugins: [
tsconfigPaths(),
@@ -17,14 +16,16 @@ export default defineConfig(() => {
viteStaticCopy({
targets: [{ src: 'src/graphql/schema/types', dest: '' }],
}),
...VitePluginNode({
adapter: ({ app, req, res }) => {
// Example adapter code to run src/index.ts with VitePluginNode
app(req, res);
},
appPath: 'src/index.ts',
initAppOnBoot: true,
})
...(mode === 'development'
? VitePluginNode({
adapter: ({ app, req, res }) => {
// Example adapter code to run src/index.ts with VitePluginNode
app(req, res);
},
appPath: 'src/index.ts',
initAppOnBoot: true,
})
: []),
],
define: {
'process.env': 'process.env',
@@ -36,8 +37,8 @@ export default defineConfig(() => {
'pty.js',
'term.js',
'class-transformer/storage',
'unicorn-magic'
]
'unicorn-magic',
],
},
build: {
sourcemap: true,
@@ -49,6 +50,7 @@ export default defineConfig(() => {
},
output: {
entryFileNames: '[name].js',
format: 'es', // Change the format to 'es' to support top-level await
},
},
modulePreload: false,