fxmontigny / quill-image-upload

A module for Quill rich text editor to upload images to be selected from toolbar editor.
107 stars 43 forks source link

ParseError: 'import' and 'export' may appear only with 'sourceType: module' #21

Closed steodor closed 3 years ago

steodor commented 3 years ago

Hi, i cannot use this module because my code won't bundle:

node_modules\quill-image-upload\index.js:6
export class ImageUpload {
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

Any ideas?

steodor commented 3 years ago

Never mind, my setup wasn't handling ES6 imports all that well. The ES5 imports are in dist, but package.json lists src/... as the main entry point. So i just changed the import from

import ImageUploader from 'quill-image-uploader';

to

import ImageUploader from '../node_modules/quill-image-uploader/dist/quill.imageUploader.min.js';

and that did the trick. Make sure to add as many ../ as needed before node_modules to get the right relative path for your usecase.