首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当前未启用对实验语法'moduleAttributes‘的支持

当前未启用对实验语法'moduleAttributes‘的支持
EN

Stack Overflow用户
提问于 2020-07-01 04:25:24
回答 1查看 128关注 0票数 0

我还没有找到一个针对'moduleAttributes‘的实验性语法解决方案,尽管我已经看到了许多类似于'classProperties’的解决方案

错误:

代码语言:javascript
复制
./components/crud/CreateBlog.js:10:70
Syntax error: Support for the experimental syntax 'moduleAttributes' isn't currently enabled (10:71):

   8 | import { getTags } from '../../actions/tag';
   9 | import { createBlog } from '../../actions/blog';
> 10 | const ReactQuill = dynamic(() => import('react-quill', { ssr: false }));
     |                                                                       ^
  11 | import '../../node_modules/react-quill/dist/quill.snow.css';
  12 | 
  13 | const CreateBlog = ({ router }) => {

组件生成错误:

代码语言:javascript
复制
import Link from 'next/link';
import { useState, useEffect } from 'react';
import Router from 'next/router';
import dynamic from 'next/dynamic';
import { withRouter } from 'next/router';
import { getCookie, isAuth } from '../../actions/auth';
import { getCategories } from '../../actions/category';
import { getTags } from '../../actions/tag';
import { createBlog } from '../../actions/blog';
const ReactQuill = dynamic(() => import('react-quill', { ssr: false }));
import '../../node_modules/react-quill/dist/quill.snow.css';

const CreateBlog = ({ router }) => {
    return (
        <div>
            <h3>Create Blog Form</h3>
        </div>
    )
}

export default withRouter(CreateBlog);

错误本身是由传递到import()调用的{ ssr: false }选项对象生成的。

关于如何解决这个问题或为什么会发生这种情况,有什么想法或知识吗?谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-07-01 05:51:01

对象应该是dynamic函数的第二个参数,而不是import

代码语言:javascript
复制
const ReactQuill = dynamic(() => import('react-quill'),{ ssr: false });

Docs

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62665627

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档