From 6bf27a53e6e72ebb5b1133ac4fa581ca79b28517 Mon Sep 17 00:00:00 2001 From: Guilherme Rodrigues Date: Thu, 10 Feb 2022 11:14:46 -0300 Subject: [PATCH] Remove hack thanks to output.format vite config --- HACK__patch_vite.ts | 10 ---------- package-lock.json | 1 - package.json | 3 +-- vite.config.js | 1 + 4 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 HACK__patch_vite.ts diff --git a/HACK__patch_vite.ts b/HACK__patch_vite.ts deleted file mode 100644 index 54a58e8..0000000 --- a/HACK__patch_vite.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Vite internals ensure ssr builds use CommonJS. Deno needs ES Modules. Here we are. -const FILE_TO_CHANGE = "./node_modules/vite/dist/node/chunks/dep-f5552faa.js" -const replaceFrom = "format: ssr ? 'cjs' : 'es'," -const replaceTo = "format: 'es'," -const depsFileContent = await Deno.readTextFile(FILE_TO_CHANGE); -Deno.writeTextFile( - FILE_TO_CHANGE, - depsFileContent.replace(replaceFrom, replaceTo), -) -console.log (`Finished applying vite ES module hack in ${FILE_TO_CHANGE}.`) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 80feff0..d8923e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,6 @@ "packages": { "": { "version": "0.0.1", - "hasInstallScript": true, "license": "MIT", "devDependencies": { "@builder.io/qwik": "0.0.16-10", diff --git a/package.json b/package.json index 017a8e5..35a2c17 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ "fmt": "prettier --write .", "fmt.check": "prettier --check .", "serve": "denon start", - "start": "npm run dev", - "postinstall": "deno run --allow-read --allow-write HACK__patch_vite.ts" + "start": "npm run dev" }, "devDependencies": { "@builder.io/qwik": "0.0.16-10", diff --git a/vite.config.js b/vite.config.js index f775829..a904e5a 100644 --- a/vite.config.js +++ b/vite.config.js @@ -10,6 +10,7 @@ export default defineConfig({ build: { rollupOptions: { output: { + 'format': isServerBuild ? 'esm' : undefined, chunkFileNames: 'q-[hash].js', assetFileNames: 'q-[hash].[ext]', },