- Issue created by @vibrasphere
- First commit to issue fork.
- Assigned to sourabhsisodia_
Hii @vibrasphere i have tried adding type="module" attribute in script tag
// // Conditionally add the type attribute if not preprocessing. if (!$this->preprocess) { $library_info['js'][$path]['type'] = 'module'; }
But its generating this error in browser console -
Refused to execute script from 'https://sample-project-6.lndo.site/sites/default/files/js/js_WxBRRZO33tx...' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
And on further troubleshooting i have found that the js file for the script is not generating .
- Merge request !27Issue #3461294: Added functionality to use import statement in js. → (Open) created by sourabhsisodia_
@vibrasphere solved the above error , please review the MR !27.
- Issue was unassigned.
- Status changed to Needs review
4 months ago 12:47pm 15 July 2024 - 🇱🇹Lithuania vibrasphere
Hi, it's working, but now all of the asset injector created .js files has type="module".
Reproduce:
- Create plain JS Injector
- Flush caches
- Check source, it has the type="module"Solution: Maybe a checkbox in the settings or something?
Current solution is still fine, thanks for great work.
- Status changed to Needs work
4 months ago 8:09am 16 July 2024 - 🇩🇪Germany Anybody Porta Westfalica
Well I think this should be a setting then, allowing to select the type to use, defaulting to the old (empty) type?
- Assigned to sourabhsisodia_
Hi, this is my first time commenting here, so apologies if I'm doing this wrong. I wrote a fix that worked for me. This patch should add a new option to use a type="module" attribute on the injected script tag.
- 🇱🇹Lithuania vibrasphere
This works, thanks. Patch applies only for stable 2.20 and not -dev as set in this issue.