-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(LayoutPlugin): allow to set and pass crossOrigin for styles and scripts #46
Conversation
@@ -65,13 +65,14 @@ export function createLayoutPlugin({ | |||
...jsAssets.map((js) => ({ | |||
src: getAbsoluteUrl(publicPath, js, options?.prefix), | |||
defer: true, | |||
crossOrigin: 'anonymous' as const, | |||
crossOrigin: options.scriptsCrossOrigin || 'anonymous', |
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 only allows you to change the default to "use-credentials", right?
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.
Yes. I left "anonymous" as default. But for consistency added scriptsCrossOrigin as possible option.
@@ -65,13 +65,14 @@ export function createLayoutPlugin({ | |||
...jsAssets.map((js) => ({ | |||
src: getAbsoluteUrl(publicPath, js, options?.prefix), | |||
defer: true, | |||
crossOrigin: 'anonymous' as const, | |||
crossOrigin: options.scriptsCrossOrigin || 'anonymous', |
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.
What about using crossOrigin
from options in other places?
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 don't know where else crossOrigin may be needed. We encountered situation, that we need it only for stylesheets.
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.
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.
Ok, fair enough, i've added the same settings for this case
Idea is to pass crossOrigin from plugin options to scripts and styles.