From 2d9e23ca670a4d11d3de510813e16d43c7ee11d9 Mon Sep 17 00:00:00 2001 From: Fabien Arcellier Date: Mon, 5 Feb 2024 13:33:46 +0100 Subject: [PATCH] fix: custom components build properly on windows * fix: rollup on windows need to use class import and don't have .ts as suffix --- ui/vite.config.custom.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/ui/vite.config.custom.js b/ui/vite.config.custom.js index f44ac3607..3cdf780a9 100644 --- a/ui/vite.config.custom.js +++ b/ui/vite.config.custom.js @@ -1,18 +1,9 @@ -import { fileURLToPath, URL } from "url"; +import path from "path"; import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import monacoEditorPlugin from "vite-plugin-monaco-editor"; -/* -injectionKeys is externalised so that it can be linked at runtime. -Otherwise, new, independent instances of Symbol would be created, for which -nothing would be provided. -*/ -const injectionKeysPath = fileURLToPath( - new URL("src/injectionKeys.ts", import.meta.url), -); - export default defineConfig({ base: "./", plugins: [vue(), { ...monacoEditorPlugin({}), apply: "serve" }], @@ -28,11 +19,11 @@ export default defineConfig({ fileName: "templates", }, rollupOptions: { - external: ["vue", injectionKeysPath], + external: ["vue", "../injectionKeys"], output: { globals: { vue: "vue", - [injectionKeysPath]: "injectionKeys", + [path.resolve("src/injectionKeys")]: "injectionKeys", }, }, }, @@ -41,7 +32,7 @@ export default defineConfig({ }, resolve: { alias: { - "@": fileURLToPath(new URL("./src", import.meta.url)), + "@": path.resolve("src"), }, }, server: {