Expand edge gateway workspace and streamline app loading

This commit is contained in:
Jeppe Bundgaard
2026-04-23 13:33:12 +02:00
parent 4ef59b0355
commit 3a4cdbaeb9
384 changed files with 18614 additions and 616 deletions
+38 -3
View File
@@ -61,6 +61,22 @@ function patchBuefyCssMediaQuery() {
}
}
function stripBrokenVueToastNotificationSourceMap() {
return {
name: 'strip-broken-vue-toast-notification-sourcemap',
enforce: 'pre',
load(id) {
if (id.startsWith('\0') || !id.includes('vue-toast-notification/dist/index.js')) {
return null
}
const filePath = id.split('?')[0]
const code = fs.readFileSync(filePath, 'utf8')
return code.replace(/\n?\/\/\# sourceMappingURL=mitt\.mjs\.map\s*$/m, '')
}
}
}
async function loadVitePwaPlugin(workspaceRoot) {
const localPluginEntry = path.resolve(workspaceRoot, 'node_modules.external-link', 'vite-plugin-pwa', 'dist', 'index.js')
@@ -81,6 +97,13 @@ export default defineConfig(async ({ mode }) => {
const isPlaywrightRuntime = process.env.PLAYWRIGHT === '1'
const shouldDisableDepOptimizer = process.platform === 'win32'
const workspaceRoot = process.cwd()
const vueToastNotificationSourceEntry = path.resolve(
workspaceRoot,
'node_modules',
'vue-toast-notification',
'src',
'index.js'
)
const vitePwaModule = await loadVitePwaPlugin(workspaceRoot)
const VitePWA = vitePwaModule?.VitePWA
@@ -121,6 +144,7 @@ export default defineConfig(async ({ mode }) => {
base,
plugins: [
patchBuefyCssMediaQuery(),
stripBrokenVueToastNotificationSourceMap(),
vue(),
VueJsx(),
!isProd && !isPlaywrightRuntime && vueDevTools(),
@@ -214,11 +238,21 @@ export default defineConfig(async ({ mode }) => {
})
].filter(Boolean),
resolve: {
alias: {
preserveSymlinks: true,
alias: [
// Anchor aliases to the active workspace so hardlinked worktrees do not
// accidentally resolve into a sibling checkout.
'@': path.resolve(workspaceRoot, 'src')
}
{
find: '@',
replacement: path.resolve(workspaceRoot, 'src')
},
// On Windows we disable dependency prebundling, so package-root imports must
// stay on the ESM source entry instead of the published UMD bundle.
{
find: /^vue-toast-notification$/,
replacement: vueToastNotificationSourceEntry
}
]
},
define: {
'import.meta.env.VITE_BUILD_DATE': JSON.stringify(new Date().toISOString()),
@@ -226,6 +260,7 @@ export default defineConfig(async ({ mode }) => {
'import.meta.env.VITE_COMMIT_HASH': JSON.stringify(commit),
// Tip: import.meta.env.DEV/PROD are available at runtime
'import.meta.env.VITE_IS_DEV': JSON.stringify(!isProd),
'import.meta.env.VITE_IS_PLAYWRIGHT': JSON.stringify(isPlaywrightRuntime),
},
css: {
preprocessorOptions: {