Skip to content

Commit c5e1d29

Browse files
author
mdatelle
committed
refactor: update config and scripts to ensure production mode
1 parent 57526de commit c5e1d29

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

web/components/UserProfile/DropdownLaunchpad.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script lang="ts" setup>
2-
import { BrandButton, BrandLoadingWhite } from '@unraid/ui';
2+
import { BrandButton, BrandLoading } from '@unraid/ui';
33
import { useServerStore } from '~/store/server';
44
import { useUnraidApiStore } from '~/store/unraidApi';
55
import { storeToRefs } from 'pinia';
6+
import { h } from 'vue';
67
import type { ComposerTranslation } from 'vue-i18n';
78
89
defineProps<{ t: ComposerTranslation }>();
@@ -34,7 +35,11 @@ const showExpireTime = computed(
3435
<BrandButton
3536
class="w-full"
3637
:disabled="unraidApiStatus === 'connecting' || unraidApiStatus === 'restarting'"
37-
:icon="unraidApiStatus === 'restarting' ? BrandLoadingWhite : unraidApiRestartAction?.icon"
38+
:icon="
39+
unraidApiStatus === 'restarting'
40+
? h(BrandLoading, { variant: 'white' })
41+
: unraidApiRestartAction?.icon
42+
"
3843
:text="
3944
unraidApiStatus === 'restarting' ? t('Restarting unraid-api…') : t('Restart unraid-api')
4045
"

web/nuxt.config.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default defineNuxtConfig({
4747
},
4848

4949
devtools: {
50-
enabled: true,
50+
enabled: process.env.NODE_ENV === 'development',
5151
},
5252

5353
modules: [
@@ -78,6 +78,11 @@ export default defineNuxtConfig({
7878
componentDir: './components/shadcn',
7979
},
8080

81+
app: {
82+
buildAssetsDir: '/_nuxt/',
83+
cdnURL: process.env.NUXT_APP_CDN_URL,
84+
},
85+
8186
vite: {
8287
plugins: [
8388
// Only remove non-critical console methods when VITE_ALLOW_CONSOLE_LOGS is false
@@ -87,6 +92,10 @@ export default defineNuxtConfig({
8792
includes: ['log', 'info', 'debug'],
8893
}),
8994
],
95+
define: {
96+
'globalThis.__DEV__': process.env.NODE_ENV === 'development',
97+
__VUE_PROD_DEVTOOLS__: false,
98+
},
9099
build: {
91100
minify: 'terser',
92101
terserOptions: {
@@ -151,9 +160,7 @@ export default defineNuxtConfig({
151160
name: 'UnraidWelcomeModal',
152161
path: '@/components/WelcomeModal.ce',
153162
},
154-
{ name: 'UnraidSsoButton',
155-
path: '@/components/SsoButton.ce'
156-
},
163+
{ name: 'UnraidSsoButton', path: '@/components/SsoButton.ce' },
157164
],
158165
},
159166
],

web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"prebuild:webgui": "./scripts/prebuild-webgui-set-env.sh",
1414
"build:webgui": "npm run type-check && nuxt build && npm run manifest-ts && npm run copy-to-webgui-repo",
1515
"postbuild:webgui": "./scripts/postbuild-webgui-restore-env.sh",
16-
"build": "npm run type-check && nuxt build && npm run manifest-ts",
16+
"build": "NODE_ENV=production npm run type-check && nuxt build && npm run manifest-ts",
1717
"deploy-to-unraid:dev": "./scripts/deploy-dev.sh",
1818
"copy-to-webgui-repo": "./scripts/copy-to-webgui-repo.sh",
1919
"manifest-ts": "node ./scripts/add-timestamp-webcomponent-manifest.js",
2020
"generate": "nuxt generate",
2121
"preview": "nuxt preview",
2222
"postinstall": "nuxt prepare",
23-
"serve": "serve dist/nuxt-custom-elements/unraid-components",
23+
"serve": "NODE_ENV=production PORT=4321 node .output/server/index.mjs",
2424
"codegen": "graphql-codegen --config codegen.ts -r dotenv/config",
2525
"codegen:watch": "graphql-codegen --config codegen.ts --watch -r dotenv/config",
2626
"test": "vitest",

0 commit comments

Comments
 (0)