Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Allow to apply arbitrary plugins when compiling ServiceWorker script#358

Open
akihikodaki wants to merge1 commit intoNekR:master
base:master
Choose a base branch
Loading
fromkagucho:master

Conversation

akihikodaki
Copy link

@akihikodakiakihikodaki commentedMar 20, 2018
edited
Loading

I'd like to use this feature to embed some environment variables in my custom entry module withEnvironmentPlugin. I have optionalCDN_HOST environment variable to determine an object storage in use. The entry module should have the variable, and be able to cache files served from the host.

There could be other use cases, considering the wide use ofprocess.env.NODE_ENV. It is nice to have.

Question: I have not implemented a test case, but should I? Should I place it attests/legacy ortests? (I'm not sure whatlegacy means.)

@NekR
Copy link
Owner

Question: I have not implemented a test case, but should I? Should I place it at tests/legacy or tests? (I'm not sure what legacy means.)

Yeah, please, write tests.legacy it's just name, there were supposed to be new tests, but they were never made. Of course, if all tests are intests/legacy, then you should put yours there as well.

@@ -30,6 +30,11 @@ export default class OfflinePlugin {
AppCache: false
});

if (options.ServiceWorker && options.ServiceWorker.plugins) {
Copy link
Owner

Choose a reason for hiding this comment

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

This should be done inServiceWorker.js file

Copy link
Author

Choose a reason for hiding this comment

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

It cannot be because it refers tooptions, notthis.options.

Copy link
Owner

Choose a reason for hiding this comment

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

That sounds wrong.ServiceWorker options shouldn't be touched inindex.js, they all are handled inServiceWorker.js file.

Copy link
Author

Choose a reason for hiding this comment

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

I have to clarify a bit more. It usesdeepExtend to set upthis.options, andaddTool passes it toServiceWorker.js. However,deepExtend breaksthis.options.ServiceWorker.plugins andServiceWorker.js can do nothing with it when received. Therefore it has to be fixed beforehand.

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, I see what you mean now. It should be handled in some other way though. I'll merge this and do the change to this part myself.

(tests seem to fail now because master has been updated)

@NekR
Copy link
Owner

I'll be happy to merge this once everything is fixed.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@NekRNekRNekR requested changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@akihikodaki@NekR

[8]ページ先頭

©2009-2025 Movatter.jp