【发布时间】:2021-02-21 08:09:00
【问题描述】:
我愿意shopify react tutorial。 但 MyApp 显示此错误。
./node_modules/@shopify/polaris/dist/styles.css
TypeError: The 'compilation' argument must be an instance of Compilation
我该如何解决?
| Package | version |
|---|---|
| Node | 15.9.0 |
| npm | 7.5.3 |
| yarn | 1.22.10 |
| @shopify/koa-shopify-auth | ^3.2.8 |
| @shopify/polaris | ^6.0.1 |
| @zeit/next-css | ^1.0.1 |
| dotenv | ^8.2.0 |
| isomorphic-fetch | ^3.0.0 |
| koa | ^2.13.1 |
| koa-session | ^6.1.0 |
| next | ^10.0.7 |
| react | ^17.0.1 |
| react-dom | ^17.0.1 |
| webpack | ^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;
【问题讨论】:
标签: reactjs next.js shopify shopify-api