-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts.timestamp-1700577238462-9bbb5fbf1c38a.mjs
78 lines (78 loc) · 7.92 KB
/
vite.config.ts.timestamp-1700577238462-9bbb5fbf1c38a.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// vite.config.ts
import inject from 'file:///home/elinuani/Desktop/ICP/experimental_dao/node_modules/@rollup/plugin-inject/dist/es/index.js';
import { sveltekit } from 'file:///home/elinuani/Desktop/ICP/experimental_dao/node_modules/@sveltejs/kit/src/exports/vite/index.js';
import compression from 'file:///home/elinuani/Desktop/ICP/experimental_dao/node_modules/vite-plugin-compression/dist/index.mjs';
import { readFileSync } from 'fs';
import { join } from 'path';
import {
defineConfig,
loadEnv
} from 'file:///home/elinuani/Desktop/ICP/experimental_dao/node_modules/vite/dist/node/index.js';
var network = process.env.DFX_NETWORK ?? 'local';
var host = network === 'local' ? 'http://localhost:8000' : 'https://ic0.app';
var readCanisterIds = ({ prefix }) => {
const canisterIdsJsonFile =
network === 'ic'
? join(process.cwd(), 'canister_ids.json')
: join(process.cwd(), '.dfx', 'local', 'canister_ids.json');
try {
const config2 = JSON.parse(readFileSync(canisterIdsJsonFile, 'utf-8'));
return Object.entries(config2).reduce((acc, current) => {
const [canisterName, canisterDetails] = current;
return {
...acc,
[`${prefix ?? ''}${canisterName.toUpperCase()}_CANISTER_ID`]: canisterDetails[network]
};
}, {});
} catch (e) {
throw Error(`Could not get canister ID from ${canisterIdsJsonFile}: ${e}`);
}
};
var config = {
plugins: [
sveltekit(),
compression({
// plugin options
})
],
build: {
target: 'es2020',
rollupOptions: {
// Polyfill Buffer for production build
plugins: [
inject({
modules: { Buffer: ['buffer', 'Buffer'] }
})
]
}
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: 'globalThis'
}
}
}
};
var vite_config_default = defineConfig(({ mode }) => {
process.env = {
...process.env,
...loadEnv(mode ?? 'development', process.cwd()),
...readCanisterIds({ prefix: 'VITE_' }),
VITE_DFX_NETWORK: network,
VITE_HOST: host
};
return {
...config,
// Backwards compatibility for auto generated types of dfx that are meant for webpack and process.env
define: {
'process.env': {
...readCanisterIds({}),
DFX_NETWORK: network
}
}
};
});
export { vite_config_default as default };
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvaG9tZS9lbGludWFuaS9EZXNrdG9wL0lDUC9leHBlcmltZW50YWxfZGFvXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvaG9tZS9lbGludWFuaS9EZXNrdG9wL0lDUC9leHBlcmltZW50YWxfZGFvL3ZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9ob21lL2VsaW51YW5pL0Rlc2t0b3AvSUNQL2V4cGVyaW1lbnRhbF9kYW8vdml0ZS5jb25maWcudHNcIjtpbXBvcnQgaW5qZWN0IGZyb20gJ0Byb2xsdXAvcGx1Z2luLWluamVjdCc7XG5pbXBvcnQgeyBzdmVsdGVraXQgfSBmcm9tICdAc3ZlbHRlanMva2l0L3ZpdGUnO1xuaW1wb3J0IGNvbXByZXNzaW9uIGZyb20gJ3ZpdGUtcGx1Z2luLWNvbXByZXNzaW9uJztcbmltcG9ydCB7IHJlYWRGaWxlU3luYyB9IGZyb20gJ2ZzJztcbmltcG9ydCB7IGpvaW4gfSBmcm9tICdwYXRoJztcbmltcG9ydCB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