node.js - 当前未启用对实验语法“moduleAttributes”的支持
问题描述
还没有找到“moduleAttributes”的实验性语法解决方案,尽管我已经为其他人看到了很多,比如“classProperties”
错误:
./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 }) => {
组件生成错误:
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 } 选项对象生成的。
关于如何解决这个问题或为什么会发生的任何想法或知识?谢谢!
解决方案
该对象应该是dynamic
函数的第二个参数 not import
:
const ReactQuill = dynamic(() => import('react-quill'),{ ssr: false });
推荐阅读
- javascript - 单击其他位置后,值从输入字段中消失?
- python - 从不同的应用程序导入类时出现 ModuleNotFoundError
- reactjs - 在 react js 和 Next js 应用程序中动态添加特定的图像和标题到 Facebook 共享链接
- python - 在终端中更改 python3 命令目录
- excel - 将数字转换为分钟和秒的 Excel 公式给了我错误
- javascript - 如何在js中进行函数队列执行
- javascript - Papaparse,ReferenceError:未定义变量
- mongodb - 使用 IIS 使用反向代理访问 Mongo DB
- powershell - 用于更改现有日期并添加 1 小时的 Powershell 脚本
- php - 如果新版本的脚本正在运行,如何清除 PHP APCu 缓存?