简体   繁体   中英

Utilise jQuery plugin with ES6 import

I've installed the jquery plugin summernote using npm and it's within my node_modules directory.

I'm now trying to utilise the summernote function in much the same way as I was before when I was just loading the scripts within the html.

import { summernote } from 'summernote';

export default function () {
    const summernote = $('.editor');
    summernote.summernote();
}

I can't get past the above code throwing summernote.summernote is not a function

This module doesn't export anything useful (like it should be expected from jQuery plugin package).

Imported summernote isn't used, and unused imported member makes an import a noop.

It should be

import 'summernote';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM