Skip to content

Commit cdc828b

Browse files
build: jspmga targets, strengthen matching.
1 parent de9b305 commit cdc828b

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

scripts/build-prepare.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ await createProdImportsModule()
7272
const html = await readFile(distIndexHtml, 'utf8')
7373

7474
if (!html.includes(productionRuntimeScript)) {
75-
const moduleScriptTag = '<script type="module" src="bootstrap.js"></script>'
75+
const bootstrapModuleScriptRegex =
76+
/<script\b(?=[^>]*\btype=(['"])module\1)(?=[^>]*\bsrc=(['"])bootstrap\.js\2)[^>]*>\s*<\/script>/i
7677
const updatedHtml = html.replace(
77-
moduleScriptTag,
78-
`${productionRuntimeScript}\n ${moduleScriptTag}`,
78+
bootstrapModuleScriptRegex,
79+
match => `${productionRuntimeScript}\n ${match}`,
7980
)
8081

8182
if (updatedHtml === html) {

src/cdn.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,22 @@ export const cdnImportSpecs = {
4747
cssBrowser: {
4848
importMap: '@knighted/css/browser',
4949
esm: '@knighted/css/browser',
50+
jspmGa: 'npm:@knighted/css/browser',
5051
},
5152
jsxDom: {
5253
importMap: '@knighted/jsx',
5354
esm: '@knighted/jsx',
55+
jspmGa: 'npm:@knighted/jsx',
5456
},
5557
jsxTranspile: {
5658
importMap: '@knighted/jsx/transpile',
5759
esm: '@knighted/jsx/transpile',
60+
jspmGa: 'npm:@knighted/jsx/transpile',
5861
},
5962
jsxReact: {
6063
importMap: '@knighted/jsx/react',
6164
esm: '@knighted/jsx/react',
65+
jspmGa: 'npm:@knighted/jsx/react',
6266
},
6367
react: {
6468
importMap: 'react',
@@ -77,14 +81,17 @@ export const cdnImportSpecs = {
7781
'sass@1.93.2/sass.default?conditions=browser',
7882
],
7983
unpkg: 'sass@1.93.2/sass.default.js?module',
84+
jspmGa: 'npm:sass@1.93.2/sass.default.js',
8085
},
8186
less: {
8287
importMap: 'less',
8388
esm: 'less',
89+
jspmGa: 'npm:less',
8490
},
8591
lightningCssWasm: {
8692
importMap: '@parcel/css-wasm',
8793
esm: '@parcel/css-wasm',
94+
jspmGa: 'npm:@parcel/css-wasm',
8895
},
8996
}
9097

0 commit comments

Comments
 (0)