Closed narsiliko closed 3 years ago
This error happens because
webpack@4.x.x
didn't support ES2020 yet, in this case, optional chaining, it should be ok if you usewebpack@5.x.x
Fixed in ^1.0.0-alpha.10
or latest alpha version:
npm i @vueup/vue-quill@1.0.0-alpha.10
and import it as usual
import "@vueup/vue-quill/dist/vue-quill.snow.css";
import { QuillEditor } from "@vueup/vue-quill";
Warning: for now on, VueQuill didn't support export default, to make it consistent between es-module and commonjs
use named import instead:
// commonjs
const { QuillEditor } = require("@vueup/vue-quill");
// es
import { QuillEditor } from "@vueup/vue-quill";
This error happens because
webpack@4.x.x
didn't support ES2020 yet, in this case, optional chaining, it should be ok if you usewebpack@5.x.x
Fixed in
^1.0.0-alpha.10
or latest alpha version:
npm i @vueup/vue-quill@1.0.0-alpha.10
and import it as usual
import "@vueup/vue-quill/dist/vue-quill.snow.css"; import { QuillEditor } from "@vueup/vue-quill";
Warning: for now on, VueQuill didn't support export default, to make it consistent between es-module and commonjs
use named import instead:
// commonjs const { QuillEditor } = require("@vueup/vue-quill"); // es import { QuillEditor } from "@vueup/vue-quill";
After update to version ^1.0.0-alpha.10 I tried to import plugin this way
import { QuillEditor } from '@vueup/vue-quill'
but got an error
Uncaught Error: Module build failed: Error: ENOENT: no such file or directory
If I import plugin this way
import { QuillEditor } from '@vueup/vue-quill/dist/vue-quill.esm-bundler'
I getting this warns
runtime-core.esm-bundler.js:38 [Vue warn]: onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.
[Vue warn]: onBeforeUnmount is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.
[Vue warn]: Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.
at <QuillEditor theme="snow" toolbar="minimal" >
at <InputRichText>
at <InputBlock>
at <New3 key=2 >
at <New>
and seeing just rectangle without toolbar and text field instead of editor I can`t interact with.
Hmm, I'm not sure what's the problem, without knowing the entire setup. Yet, can you share your source code?
Hmm, I'm not sure what's the problem, without knowing the entire setup. Yet, can you share your source code?
Yes, here is the code of the component where I`m using plugin
<template>
<div
class="form-field"
:class="[
{
'not-empty': modelValue?.toString().length > 0,
'form-field--disabled': disabled,
'form-field--requesting': requesting,
'form-field--success': success,
'form-field--error': typeof error === 'string' && error?.length > 0,
},
fieldClass
]"
>
<div class="input textarea" :style="{ height: height }">
<quill-editor
theme="snow"
toolbar="minimal"
>
</quill-editor>
<!-- <textarea
:value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
class="textarea__textarea"
:class="{ 'not-empty': modelValue?.toString().length > 0 }"
v-bind="$attrs"
/>
<label class="textarea__label" v-html="label" :class="{ 'not-empty': modelValue?.toString().length > 0 }"></label> -->
</div>
</div>
</template>
<script type="text/javascript">
import { QuillEditor } from '@vueup/vue-quill/dist/vue-quill.esm-bundler'
import '@vueup/vue-quill/dist/vue-quill.snow.css'
export default {
name: "input-rich-text",
components: {
QuillEditor
},
inheritAttrs: false,
props: {
modelValue: String,
value: String,
label: String,
height: String,
error: String,
fieldClass: String,
disabled: {
type: Boolean,
default: false,
},
requesting: {
type: Boolean,
default: false
},
success: {
type: Boolean,
default: false
},
error: {
type: String,
default: ''
},
},
emits: ['update:modelValue'],
}
</script>
I have tried the code and worked as expected, clone this repo for the source code: https://github.com/vueup/vue-quill-webpack-test.git
I have tried the code and worked as expected, clone this repo for the source code: https://github.com/vueup/vue-quill-webpack-test.git
Yes, in your environment plugin works correctly. But I have different env with webpack, vue-loader, etc. On my env I still have warnings and blank rectangle without interface.
I don't know if it's work and fits your need or not, but you can import QuillEditor using defineAsyncComponent()
:
import { defineAsyncComponent } from 'vue';
const QuillEditor = defineAsyncComponent(() =>
import("@vueup/vue-quill").then((VueQuill) => VueQuill.QuillEditor)
)
I don't know if it's work and fits your need or not, but you can import QuillEditor using
defineAsyncComponent()
:import { defineAsyncComponent } from 'vue'; const QuillEditor = defineAsyncComponent(() => import("@vueup/vue-quill").then((VueQuill) => VueQuill.QuillEditor) )
Unfortunately, this didn`t help
It seems that the problem is in your environment setup, I'm unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close the issue for now. Please don't hesitate to comment on the issue if you have any more information for us; we will reopen it right away! Thanks for your contribution.
I have an error when I'm trying to import the plugin onto the project.
or
and same type of errors when importing other modules
My package.json
My Webpack configuration