Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quill is not defined when i import from node_modules

I wanna use quill in my project(laravel)

When i require quill from cdn my code working

but when import from node_modules i got this error :

Quill is not defined 

what can i do?

my code :

import 'quill/quill';
var quill = new Quill('#editor', {
    theme: 'snow',
});
like image 716
Mohammad Rostami Avatar asked Oct 29 '25 05:10

Mohammad Rostami


1 Answers

You need to import Quill using the ES6 Syntax or the CommonJS require syntax.

Change the line:

import 'quill/quill';

to ES6 Syntax:

import Quill from 'quill';

Or CommonJS with Require

const Quill = require("quill");

Making the whole thing something like:

const Quill = require("quill");
var quill = new Quill('#editor', {
    theme: 'snow',
});
like image 102
DogEatDog Avatar answered Oct 30 '25 21:10

DogEatDog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!