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

feat(LayoutPlugin): allow to set and pass crossOrigin for styles and scripts #46

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

artemipanchuk
Copy link
Contributor

@artemipanchuk artemipanchuk commented Sep 14, 2024

Idea is to pass crossOrigin from plugin options to scripts and styles.

@@ -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',
Copy link
Collaborator

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?

Copy link
Contributor Author

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',
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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

@artemipanchuk artemipanchuk merged commit ce9848f into main Sep 16, 2024
2 checks passed
@artemipanchuk artemipanchuk deleted the feat/layout-plugin/cross-origin-style branch September 16, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants