Skip to content

Commit

Permalink
fix: Treat webmanifest as an entry module (#2254)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasPizsa authored and devongovett committed Nov 8, 2018
1 parent 9136cdc commit d8ddcaf
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/core/parcel-bundler/src/assets/HTMLAsset.js
Expand Up @@ -153,6 +153,20 @@ class HTMLAsset extends Asset {
}
}

if (
node.tag === 'link' &&
node.attrs.rel === 'manifest' &&
node.attrs.href
) {
node.attrs.href = this.getAttrDepHandler('href').call(
this,
node.attrs.href,
{entry: true}
);
this.isAstDirty = true;
return node;
}

for (let attr in node.attrs) {
let elements = ATTRS[attr];
// Check for virtual paths
Expand Down
20 changes: 20 additions & 0 deletions packages/core/parcel-bundler/test/html.js
Expand Up @@ -591,6 +591,26 @@ describe('html', function() {
});
});

it("should treat webmanifest as an entry module so it doesn't get content hashed", async function() {
const b = await bundle(
path.join(__dirname, '/integration/html-manifest/index.html')
);

await assertBundleTree(b, {
name: 'index.html',
assets: ['index.html'],
childBundles: [
{
type: 'webmanifest',
assets: ['manifest.webmanifest']
}
]
});

const html = await fs.readFile(path.join(__dirname, '/dist/index.html'));
assert(html.includes('<link rel="manifest" href="/manifest.webmanifest">'));
});

it('should bundle svg files correctly', async function() {
let b = await bundle(
path.join(__dirname, '/integration/html-svg/index.html')
Expand Down
@@ -0,0 +1,8 @@
<!doctype html>
<html>
<head>
<link rel="manifest" href="manifest.webmanifest" />
</head>
<body>
</body>
</html>
@@ -0,0 +1,3 @@
{

}
3 changes: 2 additions & 1 deletion packages/core/workers/test/mocha.opts
@@ -1,2 +1,3 @@
--require @parcel/babel-register
--exit
--exit
--timeout 20s

0 comments on commit d8ddcaf

Please sign in to comment.