Skip to content

Commit 11bc2cd

Browse files
pass imports on preview
1 parent ebe718d commit 11bc2cd

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/registry/domain/options-sanitiser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export default function optionsSanitiser(input: RegistryOptions): Config {
164164
const gzip = zlib.gzipSync(minified, { level: 7 });
165165
options.compiledClient = {
166166
...compiled,
167+
imports: clientOptions.imports,
167168
code: {
168169
minified,
169170
gzip,

src/registry/routes/component-preview.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function componentPreview(
3434
previewView({
3535
robots: res.conf.discovery.robots,
3636
component,
37-
importmap: getOcConfig(res.conf.path)?.development?.importmap,
37+
importmap:
38+
getOcConfig(res.conf.path)?.development?.importmap ||
39+
res.conf.compiledClient?.imports,
3840
fallbackClient: res.conf.fallbackClient
3941
? `${res.conf.fallbackRegistryUrl.replace(/\/$/, '')}/oc-client/client.dev.js`
4042
: undefined,

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export interface Config<T = any> {
174174
* @internal
175175
*/
176176
compiledClient?: {
177+
imports?: Record<string, string>;
177178
code: { gzip: Buffer; brotli: Buffer; minified: string };
178179
map: string;
179180
dev: string;

0 commit comments

Comments
 (0)