Giter Site home page Giter Site logo

Webpack 5 about circular-dependency-plugin HOT 4 CLOSED

aackerman avatar aackerman commented on June 16, 2024
Webpack 5

from circular-dependency-plugin.

Comments (4)

aackerman avatar aackerman commented on June 16, 2024

I haven't seen this specific issue before but I would assume it goes away if your import is in file1b is changed to import { file1a } from './index'. I'm not sure how import ... from './' is supposed to work

from circular-dependency-plugin.

 avatar commented on June 16, 2024

@aackerman, unfortunately using ./index makes no difference.

Import from './' just references the folder which by default looks at the index.js first - so just shorthand for ./index, really.

gtagEvents.js

export const sendPageView...

RouteAnalytics.jsx

import { sendPageView } from './index.js'
...
export default RouteAnalytics

index.js

import { sendPageView } from './gtagEvents'
import RouteAnalytics from './RouteAnalytics'

export { RouteAnalytics, sendPageView }

output

WARNING in Circular dependency detected:
src\components\common\Analytics\index.js -> src\components\common\Analytics\RouteAnalytics.jsx -> src\components\common\Analytics\index.js

from circular-dependency-plugin.

aackerman avatar aackerman commented on June 16, 2024

Maybe I'm misunderstanding your question but your latest example looks circular to me, it wouldn't be if RouteAnalytics imported gtagEvents instead of index

from circular-dependency-plugin.

 avatar commented on June 16, 2024

@aackerman, I've been using it like this for years, but looks like you're right. Even though it works, it may be causing other issues. Looks like I have a lot of refactoring to do -- I use this format all over my project. Here's a related stackexchange link for anybody else who runs into this issue.

Solution for my issue then would be to import files in the same folder from their own exports, instead of their shared index.js file.

from circular-dependency-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.