standalone-single-spa-webpack-plugin
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -40,2 +40,3 @@ let isWebpack5, HtmlWebpackPlugin; | ||
* importMapUrl?: URL; | ||
* importMapUrls?: URL[]; | ||
* importMap?: ImportMap; | ||
@@ -165,2 +166,22 @@ * isParcel?: boolean; | ||
} | ||
if (this.options.importMapUrls) { | ||
if (!Array.isArray(this.options.importMapUrls)) { | ||
throw Error( | ||
`standalone-single-spa-webpack-plugin: importMapUrls option must be an array, if present` | ||
); | ||
} | ||
this.options.importMapUrls.forEach((importMapUrl) => { | ||
scripts.push({ | ||
tagName: "script", | ||
voidTag: false, | ||
attributes: { | ||
type: "systemjs-importmap", | ||
src: importMapUrl.href, | ||
}, | ||
}); | ||
}); | ||
} | ||
scripts.push({ | ||
@@ -186,4 +207,3 @@ tagName: "script", | ||
defer: false, | ||
src: | ||
"https://cdn.jsdelivr.net/npm/import-map-overrides/dist/import-map-overrides.js", | ||
src: "https://cdn.jsdelivr.net/npm/import-map-overrides/dist/import-map-overrides.js", | ||
}, | ||
@@ -197,5 +217,4 @@ }); | ||
if (this.options.importMapOverridesLocalStorageKey) { | ||
imoUIAttrs[ | ||
"show-when-local-storage" | ||
] = this.options.importMapOverridesLocalStorageKey; | ||
imoUIAttrs["show-when-local-storage"] = | ||
this.options.importMapOverridesLocalStorageKey; | ||
} | ||
@@ -226,4 +245,3 @@ | ||
defer: false, | ||
src: | ||
"https://cdn.jsdelivr.net/npm/regenerator-runtime@0.13.7/runtime.min.js", | ||
src: "https://cdn.jsdelivr.net/npm/regenerator-runtime@0.13.7/runtime.min.js", | ||
}, | ||
@@ -230,0 +248,0 @@ }); |
{ | ||
"name": "standalone-single-spa-webpack-plugin", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "A webpack plugin to run single-spa microfrontends as standalone", | ||
@@ -11,19 +11,15 @@ "main": "lib/standalone-single-spa.js", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.20", | ||
"eslint": "^7.17.0", | ||
"eslint-config-node-important-stuff": "^1.1.0", | ||
"html-webpack-plugin": "^5.0.0-beta.4", | ||
"husky": "^4.3.7", | ||
"jest": "^26.6.3", | ||
"jest-serializer-html": "^7.0.0", | ||
"prettier": "^2.2.1", | ||
"pretty-quick": "^3.1.0", | ||
"typescript": "^4.1.3", | ||
"webpack": "5.12.1" | ||
"@types/jest": "^29.2.2", | ||
"@types/node": "^18.11.9", | ||
"eslint": "^8.27.0", | ||
"eslint-config-node-important-stuff": "^2.0.0", | ||
"html-webpack-plugin": "^5.5.0", | ||
"husky": "^8.0.2", | ||
"jest": "^29.3.1", | ||
"jest-serializer-html": "^7.1.0", | ||
"prettier": "^2.7.1", | ||
"pretty-quick": "^3.1.3", | ||
"typescript": "^4.8.4", | ||
"webpack": "5.75.0" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "pretty-quick --staged && yarn lint" | ||
} | ||
}, | ||
"peerDependencies": { | ||
@@ -30,0 +26,0 @@ "html-webpack-plugin": "*", |
@@ -51,2 +51,8 @@ # standalone-single-spa-webpack-plugin | ||
// optional - useful to add multiple import map URLs | ||
importMapUrls: [ | ||
new URL("https://my-cdn.com/importmap2.json"), | ||
new URL("https://my-cdn.com/importmap3.json"), | ||
], | ||
// optional - useful for adding an additional, local-only import map | ||
@@ -53,0 +59,0 @@ importMap: { |
19201
349
109
12