-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
66 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** @type {import('vite').UserConfig} */ | ||
|
||
import { resolve } from "node:path"; | ||
|
||
import fs from "fs-extra"; | ||
import { defineConfig, loadEnv } from "vite"; | ||
|
||
const VENDOR_CHUNK = "vendorChunk"; | ||
|
||
export default defineConfig(({ mode }) => { | ||
const env = loadEnv(mode, process.cwd()); | ||
const packageJson = fs.readJSONSync( | ||
`../ui-${env.VITE_UI_TARGET}/package.json`, | ||
); | ||
const prodDependencies = Object.keys(packageJson.dependencies).filter( | ||
(dependency) => | ||
dependency !== "react" && | ||
dependency !== "react-dom" && | ||
dependency !== "react/jsx-runtime" && | ||
dependency !== "react-dom/server" && | ||
dependency !== "tailwindcss", | ||
); | ||
prodDependencies.push( | ||
"react-dom", | ||
"react-dom/server", | ||
"react", | ||
"react/jsx-runtime", | ||
); | ||
|
||
return { | ||
esbuild: { | ||
supported: { | ||
"top-level-await": true, //browsers can handle top-level-await features | ||
}, | ||
}, | ||
build: { | ||
outDir: `dist/${env.VITE_UI_TARGET}`, | ||
emptyOutDir: false, | ||
rollupOptions: { | ||
input: { | ||
index: resolve(__dirname, "src", env.VITE_UI_TARGET, "index.html"), | ||
}, | ||
output: { | ||
assetFileNames: "assets/style[extname]", | ||
entryFileNames: "assets/[name].js", | ||
/** | ||
* Manually creating chunks for prod dependencies. | ||
*/ | ||
manualChunks: { | ||
[VENDOR_CHUNK]: prodDependencies, | ||
}, | ||
chunkFileNames(chunkInfo) { | ||
if (chunkInfo.name.includes(VENDOR_CHUNK)) { | ||
return "assets/vendor.js"; | ||
} | ||
return "[name]-[hash].js"; | ||
}, | ||
}, | ||
}, | ||
}, | ||
plugins: [], | ||
}; | ||
}); |
This file was deleted.
Oops, something went wrong.