add support for new output option jsonpScriptType
This commit is contained in:
parent
1ffcd28c0e
commit
06c19e9565
|
@ -29,6 +29,7 @@ class JsonpMainTemplatePlugin {
|
|||
const chunkMaps = chunk.getChunkMaps();
|
||||
const crossOriginLoading = this.outputOptions.crossOriginLoading;
|
||||
const chunkLoadTimeout = this.outputOptions.chunkLoadTimeout;
|
||||
const jsonpScriptType = this.outputOptions.jsonpScriptType || 'text/javascript';
|
||||
const scriptSrcPath = this.applyPluginsWaterfall("asset-path", JSON.stringify(chunkFilename), {
|
||||
hash: `" + ${this.renderCurrentHashCode(hash)} + "`,
|
||||
hashWithLength: length => `" + ${this.renderCurrentHashCode(hash, length)} + "`,
|
||||
|
@ -48,7 +49,7 @@ class JsonpMainTemplatePlugin {
|
|||
});
|
||||
return this.asString([
|
||||
"var script = document.createElement('script');",
|
||||
"script.type = 'text/javascript';",
|
||||
`script.type = '${jsonpScriptType}';`,
|
||||
"script.charset = 'utf-8';",
|
||||
"script.async = true;",
|
||||
`script.timeout = ${chunkLoadTimeout};`,
|
||||
|
|
|
@ -314,6 +314,13 @@
|
|||
"use-credentials"
|
||||
]
|
||||
},
|
||||
"jsonpScriptType": {
|
||||
"description": "This option enables loading async chunks via a custom script type, such as script type=\"module\"",
|
||||
"enum": [
|
||||
"text/javascript",
|
||||
"module"
|
||||
]
|
||||
},
|
||||
"chunkLoadTimeout": {
|
||||
"description": "Number of milliseconds before chunk request expires",
|
||||
"type": "number"
|
||||
|
|
Loading…
Reference in New Issue