【问题标题】:TypeError: The 'compilation' argument must be an instance of Compilation in ShopifyTypeError:“编译”参数必须是 Shopify 中的编译实例
【发布时间】: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


    【解决方案1】:

    您可以删除 next.config.js 文件,它会按预期工作。教程很旧。 Next.js 在 v 10 中支持 css。

    【讨论】:

      猜你喜欢
      • 2021-09-09
      • 2021-12-19
      • 2018-11-13
      • 2018-09-14
      • 2021-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多