docsifyjs / docsifyjs/docsify

executeScript does not support ES modules

オープン
#2,010 コメント 3 件 リアクション 0 件 担当者 2 名 @jhildenbiddle が担当を希望しています GitHub で見る
enhancement
主要言語
JavaScript
スター
31.5k
フォーク
5.8k
平均マージ
9日 8時間
マージ済み PR(30日)
2

説明

## 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

window.$docsify = {
executeScript: true
};

```

`README.md`:

```md

import { rgb } from "https://cdn.skypack.dev/d3-color@3";

```

#### 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

- [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

#### Please create a reproducible sandbox

[![Edit 307qqv236](https://codesandbox.io/static/img/play-codesandbox.svg)](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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。