@begin/enhance
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -10,19 +10,19 @@ let manifest | ||
module.exports = function fingerprintedFilePath(asset) { | ||
const key = asset[0] === '/' | ||
? asset.substring(1) | ||
: asset | ||
const isIndex = asset === '/' | ||
module.exports = function fingerprintedFilePath(rootRelativeAssetPath) { | ||
const asset = rootRelativeAssetPath[0] === '/' | ||
? rootRelativeAssetPath.substring(1) | ||
: rootRelativeAssetPath | ||
const local = process.env.ARC_ENV | ||
? process.env.ARC_ENV === 'testing' | ||
: process.env.NODE_ENV === 'testing' | ||
if (manifest && !local && !isIndex) { | ||
const fingerprintedFileName = manifest[key] | ||
if (manifest && !local) { | ||
const fingerprintedFileName = manifest[asset] | ||
if (!fingerprintedFileName) { | ||
throw ReferenceError(`${key} not found in the fingerprint manifest: static.json`) | ||
// You could have a custom element you want to render with enhance without a backing web component | ||
console.warn(`${asset} not found in the fingerprint manifest: static.json`) | ||
} | ||
return `/${STATIC_ROOT}/${fingerprintedFileName}` | ||
} | ||
return `/${STATIC_ROOT}/${ isIndex ? '' : key }` | ||
return `/${STATIC_ROOT}/${asset}` | ||
} | ||
{ | ||
"name": "@begin/enhance", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Server-side rendering for custom elements with template and slots support", | ||
@@ -5,0 +5,0 @@ "scripts": { |
16353