-
-
Notifications
You must be signed in to change notification settings - Fork 273
feat: add option crossOrigin
#291
base: master
Are you sure you want to change the base?
Conversation
handle cross origin worker drawing inspiration from https://benohead.com/blog/2017/12/06/cross-domain-cross-browser-web-workers/
Codecov Report
@@ Coverage Diff @@
## master #291 +/- ##
==========================================
- Coverage 76.35% 70.17% -6.18%
==========================================
Files 6 7 +1
Lines 148 171 +23
Branches 52 62 +10
==========================================
+ Hits 113 120 +7
- Misses 30 44 +14
- Partials 5 7 +2
Continue to review full report at Codecov.
|
@evilebottnawi how is my solution? If you think it is good then I'll try to improve code coverage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, I will look at this in near future, maybe we can avoid extra the crossOrigin
option and just add a new inline: 'cross-origin'
Hello. Any plans on going forward with this one? 💔 |
Could use my fork for now? |
@@ -133,6 +134,32 @@ module.exports = { | |||
}; | |||
``` | |||
|
|||
### `crossOrigin` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this PR, but let's do better name for this option, crossOrigin
sounds misleading even for me although I understand that we are trying to solve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe originPath
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change runtime logic, so I think we should point it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe workerChunkUrl
? Hard for me too, here we have two changes, using import-scripts
and pass filename like URL, it can be misleading with inline
, I think ideally we should have chunkLoadingType: 'inline-fallback' | 'inline-no-fallback' | 'import-scripts'
and set publicPath
to Absolute
URL, in runtime we should do publicPath
+ filename
for import-scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the need to use publicPath
but there's a need to have different public paths for different assets. Maybe I should test whether I can change publicPath
on the fly before importing worker. Also why do you refer to worker as "chunk" instead of "script"? Maybe have something like scriptType: "inline-fallback" | "inline-no-fallback" | "import-scripts"
?
@pckhoi I don't seem to be able to use a relative path here.
Assuming my page is Can this be achieved? Unfortunately, the URL of my page is dynamic, and therefore the |
@mwanago Yep, we need thinking more about this and solve this in more general way |
@evilebottnawi Maybe allowing a function to be used as the Instead of
do
|
We should use |
@evilebottnawi My public path is set to something else and I need it to stay this way. |
@mwanago Just for information, can you provide real use case? |
@mwanago this PR is meant to solve cross origin use cases. I think you might be able to do what you want with existing options already. What have you tried so far? Would changing Also just noticed we also have a |
@pckhoi This is precisely due to me wanting to solve my cross-origin issue. @evilebottnawi @pckhoi |
sounds resonable, I will thinking about this deeply in near future, right now I am focused on |
@alexander-akait I am pinging you 👀 |
@alexander-akait Is there any hope for tackling this issue? |
Sorry for delay, deadline + a lot of issues, I remember about this, try to return to this in near future, sorry again |
Is there any way I can help you with that? |
As minimum we need better name for this option |
@alexander-akait |
This PR contains a:
Motivation / Use-Case
Solving #281 according to this comment
Breaking Changes
No breaking changes.
Additional Info