<!-- Please don't delete this template or we'll close your issue --> <!-- Please use English language --> <!-- Before creating an issue please make sure you are using the latest version of Docsify. --> <!-- Please ask questions on StackOverflow: https://stackoverflow.com/questions/ask?tags=docsify --> <!-- Please ask questions on Discord: https://discord.gg/3NwKFyR --> ## Bug Report Currently, [`executeScript: true`](https://github.com/MichaelCurrin/docsify-js-tutorial/blob/master/docs/README.md#add-scripts) does not run [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and throws an `Uncaught SyntaxError: Cannot use import statement outside a module`. #### Steps to reproduce `index.html`: ```html <div id="app"></div> <script> window.$docsify = { executeScript: true }; </script> ``` `README.md`: ```md <script type="module"> import { rgb } from "https://cdn.skypack.dev/d3-color@3"; </script> ``` #### What is current behaviour It throws an `Uncaught SyntaxError: Cannot use import statement outside a module` #### What is the expected behaviour Run the script as an ES module (or mention in the documentation that ES modules and imports are not supported.) #### Other relevant information <!-- (Update "[ ]" to "[x]" to check a box) --> - [x] Bug does still occur when all/other plugins are disabled? - Your OS: Windows - Node.js version: 18.4.0 - npm/yarn version: npm 8.12.1 - Browser version: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 - Docsify version: 4.13.0 - Docsify plugins: None <!-- Love docsify? Please consider supporting our collective: 👉 https://opencollective.com/docsify/donate --> #### Please create a reproducible sandbox [](https://codesandbox.io/s/sweet-bogdan-6v3ic2?file=/README.md) #### Mention the docsify version in which this bug was not present (if any) docsify 4.13.0
Activity
trusktr commentedon Jul 4, 2023
Indeed! The fix should be easy.
trusktr commentedon Jul 7, 2023
Btw, for now, to emulate a type=module script like this one:
you can write it like this:
The second is essentially what the first one is doing, and the first one is syntax sugar.
sanand0 commentedon Jul 7, 2023
Thanks, @trusktr. Since I'm using ESM to simplify examples, I'll await the fix you mentioned. Very grateful! 🙏