diff --git a/src/static/index.js b/src/static/index.js index 0371a7f7..3620933f 100644 --- a/src/static/index.js +++ b/src/static/index.js @@ -24,7 +24,7 @@ module.exports = function _static (asset, options = {}) { let pkg = JSON.parse(read(manifest)) let asset = pkg[key] if (!asset) - throw ReferenceError(`Could not find asset in static.json (asset fingerprint manifest): ${key}`) + return `${path}/${key}` return `${path}/${asset}` } return `${path}/${isIndex ? '' : key}` diff --git a/test/unit/src/static/index-test.js b/test/unit/src/static/index-test.js index 556445b0..401a62e9 100644 --- a/test/unit/src/static/index-test.js +++ b/test/unit/src/static/index-test.js @@ -52,7 +52,7 @@ test('Staging env returns non-fingerprinted path if static manifest is not prese t.equal(asset, '/_static/foo.png', 'Returned non-fingerprinted path') }) -test('Staging env returns non-fingerprinted path if static manifest is present', t => { +test('Staging env returns fingerprinted path if static manifest is present', t => { t.plan(1) reset() manifestExists = true @@ -61,14 +61,13 @@ test('Staging env returns non-fingerprinted path if static manifest is present', t.equal(asset, '/_static/foo-1a2b3d.png', 'Returned fingerprinted path') }) -test('Staging env returns non-fingerprinted path if static manifest is present', t => { +test('Staging env returns non-fingerprinted path if file is not present in static manifest mapping', t => { t.plan(1) reset() manifestExists = true process.env.NODE_ENV = 'staging' - t.throws(() => { - arcStatic('bar.png') - }, 'Static helper throws error if asset is not found') + let asset = arcStatic('bar.png') + t.equal(asset, '/_static/bar.png', 'Returned non-fingerprinted path') }) test('Passing stagePath option adds API Gateway /staging or /production to path', t => {