Skip to content

Commit a1332f9

Browse files
committed
todo
1 parent 8bc8ab4 commit a1332f9

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

packages/plugin-rsc/src/plugin.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { vitePluginFindSourceMapURL } from './plugins/find-source-map-url'
3030
import {
3131
ENV_IMPORTS_MANIFEST_NAME,
3232
vitePluginImportEnvironment,
33+
type EnvironmentImportMeta,
3334
} from './plugins/import-environment'
3435
import {
3536
vitePluginResolvedIdProxy,
@@ -124,16 +125,7 @@ class RscPluginManager {
124125
{}
125126
serverReferenceMetaMap: Record<string, ServerRerferenceMeta> = {}
126127
serverResourcesMetaMap: Record<string, { key: string }> = {}
127-
environmentImportMetaMap: Record<
128-
string,
129-
{
130-
resolvedId: string
131-
targetEnv: string
132-
sourceEnv: string
133-
specifier: string
134-
entryName: string
135-
}
136-
> = {}
128+
environmentImportMetaMap: Record<string, EnvironmentImportMeta> = {}
137129
// Maps resolvedId to output fileName (populated in generateBundle)
138130
environmentImportOutputMap: Record<string, string> = {}
139131

packages/plugin-rsc/src/plugins/import-environment.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,18 @@ export function vitePluginImportEnvironment(
5151
this.environment.mode === 'build' &&
5252
source.endsWith(ENV_IMPORTS_MANIFEST_NAME)
5353
) {
54+
// TODO: relativity should be enforced via another renderChunk patch
5455
return { id: './' + ENV_IMPORTS_MANIFEST_NAME, external: true }
5556
}
56-
// Virtual scan placeholder for scan builds without entries
5757
if (source === ENV_IMPORTS_ENTRY_FALLBACK) {
5858
return '\0' + ENV_IMPORTS_ENTRY_FALLBACK
5959
}
6060
},
6161
load(id) {
62+
// TODO: how to avoid warning?
63+
// > Generated an empty chunk: "__vite_rsc_env_imports_entry_fallback".
6264
if (id === '\0' + ENV_IMPORTS_ENTRY_FALLBACK) {
63-
return 'export default () => "__vite_rsc_env_imports_entry_fallback"'
65+
return 'export default "__vite_rsc_env_imports_entry_fallback"'
6466
}
6567
},
6668
buildStart() {

0 commit comments

Comments
 (0)