JQuery $.fn 无法在 Internet Explorer 11 上运行

JQuery $.fn not working on Internet Explorer 11

我正在为富文本编辑器开发一个包装器插件。在 Chrome 上一切正常,但我需要它在 Internet Explorer 11 上工作。加载页面时,会弹出一个错误 (Object doesn't support property or method 'editor')。 JQuery 文档说 IE 应该支持 ($.fn),所以我对问题出在哪里感到困惑。我需要填充一些东西吗?

editor.js

import { ImageDrop } from "./image-drop.js";

$.fn.editor = function (options) {
  const REQUIRED = typeof(options.required) != "undefined"
    ? options.required
    : true;

// the rest of the plugin goes here
});

index.html

<div id="editor"></div>

<script type="module" src="./image-drop.js"></script>
<script type="module" src="./editor.js"></script>

<script type="text/javascript">
  $(document).ready(function () {
    $("#editor").editor({
      required: true;
    });
  });
</script>

通过反复试验找到了问题所在。 IE11 不支持模块,所以 <script type="module"> 不能是 运行.