Skip to content

Commit 83215d9

Browse files
committed
build for netlify
1 parent a4f245c commit 83215d9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

wormhole-connect/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@
4949
},
5050
"scripts": {
5151
"start": "vite",
52-
"build": "NODE_ENV=production NODE_OPTIONS=--max-old-space-size=6144 vite build",
52+
"build": "npm run build:lib; npm run build:hosted; npm run build:netlify",
53+
"build:lib": "VITE_BUILD_HOSTED=1 NODE_ENV=production NODE_OPTIONS=--max-old-space-size=6144 vite build",
5354
"build:hosted": "VITE_BUILD_HOSTED=1 NODE_ENV=production NODE_OPTIONS=--max-old-space-size=6144 vite build",
55+
"build:netlify": "VITE_BUILD_NETLIFY=1 NODE_ENV=production NODE_OPTIONS=--max-old-space-size=6144 vite build",
5456
"lint": "scripts/lint.sh",
5557
"lint:ci": "scripts/lint_ci.sh",
5658
"prettier": "prettier --write ./src",

wormhole-connect/vite.config.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ let external = [
6161
];
6262

6363
export default defineConfig(({ command, mode }) => {
64-
if (command === 'serve') {
64+
const env = loadEnv(mode, process.cwd(), '');
65+
const isHosted = !!env.VITE_BUILD_HOSTED;
66+
const isNetlify = !!env.VITE_BUILD_NETLIFY;
67+
68+
if (command === 'serve' || (command === 'build' && isNetlify)) {
6569
// Local development
6670
return {
6771
envPrefix,
@@ -92,9 +96,6 @@ export default defineConfig(({ command, mode }) => {
9296
// use React.
9397
//
9498

95-
const env = loadEnv(mode, process.cwd(), '');
96-
const isHosted = !!env.VITE_BUILD_HOSTED;
97-
9899
if (isHosted) {
99100
return {
100101
envPrefix,

0 commit comments

Comments
 (0)