【发布时间】:2021-12-05 13:53:28
【问题描述】:
我正在尝试让 Summernote 与 Webpack 一起工作,但不知何故它不起作用。
我用纱线yarn add summernote安装了summernote。
在我的 javascript 文件中,我正在导入 webpack:
import $ from 'jquery';
import 'bootstrap';
import 'summernote/dist/summernote';
$('#summernote').summernote({});
但我得到了错误:
Uncaught TypeError: jquery__WEBPACK_IMPORTED_MODULE_0___default()(...).summernote is not a function
如果我使用 dist 文件夹中的 summernote js,我的 webpack 控制台上也会出现此错误(从 src 目录 (import 'summernote/src/js/summernote.js') 导入 summernote.js 时没有此错误):
warning in ./node_modules/jQuery/dist/jquery.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /path/to/node_modules/jQuery/dist/jquery.js
Used by 1 module(s), i. e.
/path/to/node_modules/summernote/dist/summernote.js
* /path/to/node_modules/jquery/dist/jquery.js
Used by 534 module(s), i. e.
/path/to/node_modules/babel-loader/lib/index.js??ref--4-0!/path/to/assets/js/app.js
我试过这个:enter link description here,但结果相同。
【问题讨论】:
标签: javascript webpack summernote