File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "image" : " mcr.microsoft.com/devcontainers/universal:2" ,
3+ "features" : {}
4+ }import type { UserConfig } from 'vite'
5+ import path from 'node:path'
6+ // prettier-ignore
7+ const config: UserConfig = {
8+ // ---cut-before---
9+ experimental : {
10+ renderBuiltUrl(filename, { hostId, hostType, type }) {
11+ if (type === 'public') {
12+ return 'https :// www.domain.com/' + filename
13+ } else if (path.extname(hostId) === '.js') {
14+ return {
15+ runtime : `window.__assetsPath($ {JSON.stringify(filename) })`
16+ }
17+ } else {
18+ return 'https :// cdn.domain.com/assets/' + filename
19+ }
20+ },
21+ },
22+ // ---cut-after---
23+ }experimental: {
24+ renderBuiltUrl(filename, { hostId, hostType, type }) {
25+ if (type === 'public') {
26+ return 'https :// www.domain.com/' + filename
27+ } else if (path.extname(hostId) === '.js') {
28+ return {
29+ runtime : `window.__assetsPath($ {JSON.stringify(filename) })`
30+ }
31+ } else {
32+ return 'https :// cdn.domain.com/assets/' + filename
33+ }
34+ },
35+ },
36+ experimental: {
37+ renderBuiltUrl(filename, { hostType }) {
38+ if (hostType === 'js') {
39+ return { runtime : `window.__toCdnUrl($ {JSON.stringify(filename) })` }
40+ } else {
41+ return { relative : true }
42+ }
43+ },
44+ },
You can’t perform that action at this time.
0 commit comments