Bigbear
Bigbear

Reputation: 21

How to add attribute to the script which is created by webpack for dynamic import?

we know, when we use dynamic import, webpack will create script tag to load the script. But how should we add some attributes to the script created by webpack.

for example, I want to add the crossorigin attribute to the script.

the following is what webpack do for dynamic import.

webpack dynamic import output

Upvotes: 0

Views: 1066

Answers (1)

Bigbear
Bigbear

Reputation: 21

Oh, I know. I find a config from the source code node_modules/webpack/lib/web/JsonpMainTemplatePlugin.js

https://webpack.js.org/configuration/output/#outputcrossoriginloading

Upvotes: 1

Related Questions