reactjs - TypeError:“编译”参数必须是 Shopify 中的编译实例
问题描述
我做shopify反应教程。但是 MyApp 显示了这个错误。
./node_modules/@shopify/polaris/dist/styles.css
TypeError: The 'compilation' argument must be an instance of Compilation
我该如何解决?
包裹 | 版本 |
---|---|
节点 | 15.9.0 |
npm | 7.5.3 |
纱 | 1.22.10 |
@shopify/koa-shopify-auth | ^3.2.8 |
@shopify/北极星 | ^6.0.1 |
@zeit/next-css | ^1.0.1 |
dotenv | ^8.2.0 |
同构提取 | ^3.0.0 |
考阿 | ^2.13.1 |
koa会话 | ^6.1.0 |
下一个 | ^10.0.7 |
反应 | ^17.0.1 |
反应域 | ^17.0.1 |
网页包 | ^5.23.0 |
这是我的代码。
import App from 'next/app';
import Head from 'next/head';
import React from 'react';
import { AppProvider } from '@shopify/polaris';
import translations from '@shopify/polaris/locales/en.json';
import '@shopify/polaris/dist/styles.css';
class MyApp extends App {
render() {
const { Component, pageProps } = this.props;
return (
<React.Fragment>
<Head>
<title>Sample App</title>
<meta charSet="utf-8" />
</Head>
<AppProvider i18n={ translations }>
<Component {...pageProps} />
</AppProvider>
</React.Fragment>
);
}
}
export default MyApp;
解决方案
您可以删除 next.config.js 文件,它会按预期工作。教程很旧。Next.js 在 v 10 中支持 css。
推荐阅读
- c# - ASP.NET MVC 本地化或更改默认模型绑定错误消息
- shell - Ansible:在文件的现有行上附加正则表达式
- javascript - 询问如何直接在google sheet的表格上创建数据输入表格
- java - 一个未编译的基本 java 程序
- .net - DynamoDb 大表查询速度
- spring - Eclipse 上的“此位置不允许使用注释 @Autowired”错误
- php - 客户端未经授权无法使用此方法检索访问令牌 - 致命错误
- php - 如何让 ovh 从 index.html 而不是 index.php 运行我的网站?
- html - 根据百分比设置 div 背景颜色(如进度条)
- python-3.x - 将csv转换为xlsx时,如何在xlsxwriter中保留一列数字作为字符串?