Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import maps as object #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export type SingleSpaRootPluginOptions = {
type: 'root';
importMaps?: {
type?: 'importmap' | 'overridable-importmap' | 'systemjs-importmap' | 'importmap-shim';
dev?: string | string[];
build?: string | string[];
dev?: string | string[] | Record<string, any>;
build?: string | string[] | Record<string, any>;
};
imo?: boolean | string | (() => string);
imoUi?: boolean | 'full' | 'popup' | 'list' | {
Expand Down
3 changes: 3 additions & 0 deletions src/plugin-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export function pluginFactory(readFileFn?: (path: string, options: any) => Promi
}) as string;
return [contents];
}
else if (typeof fileCfg === 'object' && !Array.isArray(fileCfg)) {
return [JSON.stringify(fileCfg)];
}
else {
const fileContents: string[] = [];
for (let f of fileCfg) {
Expand Down
4 changes: 2 additions & 2 deletions src/vite-plugin-single-spa.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ declare module "vite-plugin-single-spa" {
/**
* File name or array of file names of the import map or maps to be used while developing.
*/
dev?: string | string[];
dev?: string | string[] | Record<string, any>;
/**
* File name or array of file names of the import map or maps to be used while building.
*/
build?: string | string[];
build?: string | string[] | Record<string, any>;
};

/**
Expand Down