Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Treat webmanifest as an entry module #2254

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/core/parcel-bundler/src/assets/HTMLAsset.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!doctype html>
<html>
<head>
<link rel="manifest" href="manifest.webmanifest" />
</head>
<body>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
3 changes: 2 additions & 1 deletion packages/core/workers/test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--require @parcel/babel-register
--exit
--exit
--timeout 20s
2 changes: 1 addition & 1 deletion packages/core/workers/test/workerfarm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const assert = require('assert');
const WorkerFarm = require('../index');

describe('WorkerFarm', () => {
describe('WorkerFarm', function() {
AndreasPizsa marked this conversation as resolved.
Show resolved Hide resolved
it('Should start up workers', async () => {
let workerfarm = new WorkerFarm(
{},
Expand Down