Ex - I installed #apollo/react-components to use ApolloProvider in a react project and it causes the following error:
./node_modules/#apollo/react-hooks/lib/react-hooks.esm.js Module not found: Can't resolve 'apollo-client'
It because withApollo is now part of #apollo/client. Changing the import to this should resolve the error.
import { withApollo } from '#apollo/client/react/hoc'
Related
I am using that latest swiper version: swiper 8.2.4 with create-react-app.
These suggested import statements work:
import { Navigation, Pagination } from "swiper";
import { Swiper, SwiperSlide } from "swiper/react/swiper-react.js";
However I cannot get the css imports to work with any of the suggestions of import statements online.
Currently I have tried to use these three import statement but they all give me an error.
import "swiper/swiper.scss";
import 'swiper/swiper.min.css'
import 'swiper/css';
I get this error Module not found: Error: Package path ./swiper.scss is not exported from package /app/node_modules/swiper (see exports field in /app/node_modules/swiper/package.json) even though I can see that file exists and is being exported in the package.json. Any ideas on this?
I am working on a project using Nextjs (version 11.1.0), Chakra UI/React (version 1.6.6) and Swiper React (version 7.0.2). It's working properly, but I am getting this ESLint issue:
Unable to resolve path to module 'swiper/react'`.
I already tried to use type: modules in package.json and the experimental flag in next config experimental: { esmExternals: true }. Using type: modules solves it but then Nextjs throws an error asking to remove it. The experimental flag does nothing.
Currently, these are my imports:
import { Swiper, SwiperSlide } from 'swiper/react'
import 'swiper/css'
import 'swiper/css/free-mode'
I already tried variations such as:
import { Swiper, SwiperSlide } from 'swiper/react/swiper-react.js'"
but that doesn't work either.
I'm new to swiper and I'm currently facing problem importing these following css styles from Swiper:
import "swiper/css";
import "swiper/css/navigation";
import "swiper/css/pagination";
I'm using Swiper version 6.8.4 because of some issue with eslint. I'm also using lessjs to style my page in React. So how do I solve this Unable to resolve path to module issue
I keep getting this error in React JS. I've never gotten this error ever and I literally cannot find anything on the internet. I installed react-spring. I imported it into App.js.
Attempted import error: 'animated' is not exported from 'react-spring'.
import { useSpring, animated } from "react-spring";
I already installed react-spring using: npm install react-spring
Please import 'animated' like so:
import {animated} from 'react-spring'
Since it's named export and not a default export. See the import statement example as guided here:
https://blog.logrocket.com/animations-with-react-spring/
I'm trying to use react-router with the create-react-app I just created but I'm having issues importing it. I'm importing it like I import the other react dependencies:
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Link } from 'react-router-dom';
but I'm getting this error message:
./src/index.js
Module not found: Can't resolve 'react-router-dom' in 'C:\Users\Eric\Code\react-test\src'
I've tried googling and checking on here but I can't find an answer. Why isn't it looking in node_modules?
Install react-router-dom.
I got this error message because I had followed an old tutorial that had me installing the react-router packager instead of react-router-dom package. Couldn't figure it out for a little bit.
To solve this issue, just install react-router-dom:
npm install --save react-router-dom
All set!