PrimeNG - Quill - ReferenceError Quill is not defined

UI Components for Angular
Post Reply
joeH
Posts: 1
Joined: 18 Oct 2018, 17:18

18 Oct 2018, 20:16

Wow, 2 weeks and not a single comment. Either this is so common that it's obvious to fix or so uncommon that no one has any idea how to fix it.




I have been banging me head against the wall on this for days. Any help/advice would be most appreciated.

I get this error message in the chrome console when using the primeNG Editor.

ERROR ReferenceError: Quill is not defined
at Editor.ngAfterViewInit (main-client.js:22448)
at callProviderLifecycles (vendor.js:22310)
at callElementProvidersLifecycles (vendor.js:22285)
at callLifecycleHooksChildrenFirst (vendor.js:22269)
at checkAndUpdateView (vendor.js:23366)
at callViewAction (vendor.js:23723)
at execEmbeddedViewsAction (vendor.js:23681)
at checkAndUpdateView (vendor.js:23359)
at callViewAction (vendor.js:23723)
at execEmbeddedViewsAction (vendor.js:23681)


I have installed Quill using npm and have re-run webpack.


Here are my versions
primeNg 6.1.3
quill 1.3.6


This is my webpack.config.vendor.js file

const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const merge = require('webpack-merge');
const treeShakableModules = [
'@angular/animations',
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/forms',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'zone.js',
];
const nonTreeShakableModules = [
'bootstrap',
'bootstrap/dist/css/bootstrap.css',
'es6-promise',
'es6-shim',
'event-source-polyfill',
'jquery',
'font-awesome/css/font-awesome.css',
'primeng/resources/themes/bootstrap/theme.css',
'primeng/resources/themes/nova-light/theme.css',
'primeng/resources/primeng.min.css',
'primeicons/primeicons.css',
'ngx-bootstrap/datepicker/bs-datepicker.css',
'quill/dist/quill.js',
'quill/dist/quill.min.js',
'quill/dist/quill.snow.css',
'quill/dist/quill.core.css'
];
const allModules = treeShakableModules.concat(nonTreeShakableModules);

module.exports = (env) => {
const extractCSS = new ExtractTextPlugin('vendor.css');
const isDevBuild = !(env && env.prod);
const sharedConfig = {
stats: { modules: false },
resolve: { extensions: ['.js'] },
module: {
rules: [
{ test: /\.(png|woff|woff2|eot|ttf|svg|gif)(\?|$)/, use: 'url-loader?limit=100000' }
]
},
output: {
publicPath: 'dist/',
filename: '[name].js',
library: '[name]_[hash]'
},
plugins: [
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/14898
new webpack.IgnorePlugin(/^vertx$/), // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
new webpack.ProvidePlugin({Quill: 'quill'})
]
};

const clientBundleConfig = merge(sharedConfig, {
entry: {
// To keep development builds fast, include all vendor dependencies in the vendor bundle.
// But for production builds, leave the tree-shakable ones out so the AOT compiler can produce a smaller bundle.
vendor: isDevBuild ? allModules : nonTreeShakableModules
},
output: { path: path.join(__dirname, 'wwwroot', 'dist') },
module: {
rules: [
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: isDevBuild ? 'css-loader' : 'css-loader?minimize' }) }
]
},
plugins: [
extractCSS,
new webpack.DllPlugin({
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'
})
].concat(isDevBuild ? [] : [
new webpack.optimize.UglifyJsPlugin()
])
});

const serverBundleConfig = merge(sharedConfig, {
target: 'node',
resolve: { mainFields: ['main'] },
entry: { vendor: allModules.concat(['aspnet-prerendering']) },
output: {
path: path.join(__dirname, 'ClientApp', 'dist'),
libraryTarget: 'commonjs2',
},
module: {
rules: [{ test: /\.css(\?|$)/, use: ['to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize'] }]
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, 'ClientApp', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'
})
]
});

return [clientBundleConfig, serverBundleConfig];
}



This is my package.json

{
"name": "Finance.SPA",
"private": true,
"version": "0.0.0",
"scripts": {
"test": "karma start ClientApp/test/karma.conf.js"
},
"dependencies": {
"@angular/animations": "4.2.5",
"@angular/common": "4.2.5",
"@angular/compiler": "4.2.5",
"@angular/compiler-cli": "4.2.5",
"@angular/core": "4.2.5",
"@angular/forms": "4.2.5",
"@angular/http": "4.2.5",
"@angular/platform-browser": "4.2.5",
"@angular/platform-browser-dynamic": "4.2.5",
"@angular/platform-server": "4.2.5",
"@angular/router": "4.2.5",
"@ngtools/webpack": "1.5.0",
"@types/webpack-env": "1.13.0",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.1",
"awesome-typescript-loader": "3.2.1",
"bootstrap": "3.3.7",
"css": "2.2.1",
"css-loader": "0.28.4",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "0.7.3",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.2",
"font-awesome": "^4.7.0",
"html-loader": "0.4.5",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"ngx-bootstrap": "^2.0.2",
"ngx-cookie-service": "^1.0.9",
"preboot": "4.5.2",
"primeicons": "^1.0.0-beta.10",
"primeng": "^6.1.3",
"quill": "^1.3.6",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.10",
"rxjs": "5.4.2",
"style-loader": "0.18.2",
"to-string-loader": "1.1.5",
"typescript": "2.4.1",
"url-loader": "0.5.9",
"webpack-hot-middleware": "2.18.2",
"webpack-merge": "4.1.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"@types/chai": "4.0.1",
"@types/jasmine": "2.5.53",
"@types/quill": "^2.0.0",
"chai": "4.0.2",
"jasmine-core": "2.6.4",
"karma": "1.7.0",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-webpack": "2.0.3",
"webpack": "^2.5.1",
"webpack-cli": "^3.1.1"
}
}





It seems like it can't find Quill but I do not know where it's looking.


Thanks,
Joe

dmarsola@irdeto.com
Posts: 3
Joined: 15 Mar 2022, 13:11

15 Mar 2022, 13:13

What I found is that you must install quill locally for it to run.

Code: Select all

npm i quill

francisco.stuven
Posts: 1
Joined: 24 Sep 2021, 16:35

04 Sep 2022, 15:32

Ademas de instar el Quill hay que agregar al angular.json

"styles": [
...
"node_modules/quill/dist/quill.core.css",
"node_modules/quill/dist/quill.snow.css"
],
"scripts": [
...
"node_modules/quill/dist/quill.js"
]

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests