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

Rename the workbox-google-analytics output file #1688

Merged
merged 1 commit into from
Oct 9, 2018
Merged

Conversation

philipwalton
Copy link
Member

@philipwalton philipwalton commented Oct 7, 2018

R: @jeffposnick

Fixes #1646

As far as I can tell this is working with the workbox-sw loader (and all the tests pass), but I know our e2e tests manually reference individual dependency files, so it's not clear to me if the loader logic is actually tested against built filenames.

/cc @gauntface

EDIT: Actually, looks like tests are failing; looking into it now.

@philipwalton
Copy link
Member Author

Ok, it looks like the workbox-sw integration tests are actually checking against the live CDN, which makes renaming the script files tricky. Is this the intended behavior? Do I have to push a beta release to test this, or should I alter the tests to fetch local versions?

screen shot 2018-10-07 at 11 59 32 am

@jeffposnick
Copy link
Contributor

I don't think that was intentional; you should be able to work around it and get all the tests running against the local build output by using something similar to

const wb = new self.WorkboxSW({
modulePathCb: (moduleName, debug) => {
const build = debug ? 'dev' : 'prod';
return `../../../packages/${moduleName}/build/browser/${moduleName}.${build}.js`;
},
});

@philipwalton
Copy link
Member Author

philipwalton commented Oct 8, 2018

Yeah, I can set a config for the loader, I just wanted to make sure the intent of this test wasn't to test that the CDN files were actually available.

BTW, I'm confused as to how that code you referenced even works because from my reading of the code, WorkboxSW doesn't take an options object (it defines a setConfig() method):

class WorkboxSW {
/**
* Creates a proxy that automatically loads workbox namespaces on demand.
*
* @private
*/
constructor() {

@jeffposnick
Copy link
Contributor

That's... a good question. Okay, here's a more recently updated integration test that does the same thing in what's hopefully the correct way:

importScripts('/__WORKBOX/buildFile/workbox-sw');
importScripts('/infra/testing/comlink/sw-interface.js');
workbox.setConfig({modulePathPrefix: '/__WORKBOX/buildFile/'});

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 3.09 KB -12% 1.39 KB 🎉
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.12 KB 1.88 KB +68% 935 B ☠️
packages/workbox-build/build/index.js 4.02 KB 3.64 KB -9% 1.36 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.88 KB 3.12 KB -20% 1.28 KB 🎉
packages/workbox-cli/build/app.js 6.76 KB 4.64 KB -31% 1.69 KB 🎉
packages/workbox-cli/build/bin.js 2.32 KB 1.16 KB -50% 580 B 🎉
packages/workbox-core/build/workbox-core.prod.js 7.47 KB 5.98 KB -20% 2.62 KB 🎉
packages/workbox-precaching/build/workbox-precaching.prod.js 5.81 KB 5.03 KB -13% 2.12 KB 🎉
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 1.49 KB -8% 744 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 3.23 KB +13% 1.41 KB ☠️
packages/workbox-strategies/build/workbox-strategies.prod.js 5.09 KB 4.74 KB -7% 1.19 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.57 KB 1.38 KB -12% 680 B 🎉
packages/workbox-sw/build/workbox-sw.js 1.50 KB 1.50 KB -0% 813 B
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 5.29 KB -34% 1.84 KB 🎉
packages/workbox-webpack-plugin/build/index.js 742 B 349 B -53% 255 B 🎉
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 6.91 KB -33% 2.40 KB 🎉

New Files

File Size GZipped
packages/workbox-google-analytics/build/workbox-offline-ga.prod.js 1.83 KB 935 B

All File Sizes

View Table
File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 3.09 KB -12% 1.39 KB 🎉
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.12 KB 1.88 KB +68% 935 B ☠️
packages/workbox-build/build/_types.js 41 B 41 B 0% 61 B
packages/workbox-build/build/index.js 4.02 KB 3.64 KB -9% 1.36 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.88 KB 3.12 KB -20% 1.28 KB 🎉
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 587 B 0% 347 B
packages/workbox-cli/build/app.js 6.76 KB 4.64 KB -31% 1.69 KB 🎉
packages/workbox-cli/build/bin.js 2.32 KB 1.16 KB -50% 580 B 🎉
packages/workbox-core/build/workbox-core.prod.js 7.47 KB 5.98 KB -20% 2.62 KB 🎉
packages/workbox-google-analytics/build/workbox-offline-ga.prod.js 1.83 KB 935 B
packages/workbox-navigation-preload/build/workbox-navigation-preload.prod.js 660 B 660 B 0% 319 B
packages/workbox-precaching/build/workbox-precaching.prod.js 5.81 KB 5.03 KB -13% 2.12 KB 🎉
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 1.49 KB -8% 744 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 3.23 KB +13% 1.41 KB ☠️
packages/workbox-strategies/build/workbox-strategies.prod.js 5.09 KB 4.74 KB -7% 1.19 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.57 KB 1.38 KB -12% 680 B 🎉
packages/workbox-sw/build/workbox-sw.js 1.50 KB 1.50 KB -0% 813 B
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 5.29 KB -34% 1.84 KB 🎉
packages/workbox-webpack-plugin/build/index.js 742 B 349 B -53% 255 B 🎉
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 6.91 KB -33% 2.40 KB 🎉

Workbox Aggregate Size Plugin

9.54KB gzip'ed (64% of limit)
23.61KB uncompressed

@philipwalton
Copy link
Member Author

@jeffposnick, all the tests are passing now. I had to update some of the test server logic, but it looks like things are better tested now with these changes.

Copy link
Contributor

@jeffposnick jeffposnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jeffposnick jeffposnick merged commit ae026d1 into next Oct 9, 2018
@jeffposnick jeffposnick deleted the offline-ga branch October 9, 2018 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants