Home > Enterprise >  Quill is not defined when i import from node_modules
Quill is not defined when i import from node_modules

Time:01-02

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',
});

CodePudding user response:

What about import Quill from 'quill';

CodePudding user response:

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',
});
  • Related