0

react-multi-carousel发生此错误时,我正在尝试安装库:

./node_modules/react-multi-carousel/lib/styles.css
TypeError: Cannot read properties of undefined (reading 'tap')

我认为这是因为项目使用nextjs(只知道极端基础知识)。这是我的next.config文件:

const webpack = require('webpack')
const withPlugins = require('next-compose-plugins')
const optimizedImages = require('next-optimized-images')
const withCSS = require('@zeit/next-css')
const path = require('path')

const withReactStorefront = require('react-storefront/plugins/withReactStorefront')
require('dotenv').config()

module.exports = withReactStorefront({
  target: 'serverless',
  connector: 'connector',
  webpack: config => {
    config.plugins.push(
      new webpack.optimize.LimitChunkCountPlugin({
        maxChunks: 1,
      })
    )
    return config
  },
})
const nextConfig = {
  webpack: (config, { dev }) => {

    config.module.rules.push({
      test: /\.svg$/,
      use: ['@svgr/webpack'],
    })
    
    config.plugins.push(new webpack.EnvironmentPlugin(process.env))
    config.resolve.alias['components'] = path.join(__dirname, 'components')
    config.resolve.alias['static'] = path.join(__dirname, 'static')

    return config
  },
}

module.exports = withPlugins(
  [
    [
      optimizedImages,
      {
        handleImages: ['jpeg', 'png'],
      },
    ],
    withCSS,
  ],
  nextConfig
)

此外,我正在尝试将这些样式导入到名为restaurants.js. 我尝试在里面导入_app.js,它也不起作用。

4

0 回答 0