Git Product home page Git Product logo

Comments (32)

marcelklehr avatar marcelklehr commented on September 23, 2024 42

I'm so sorry folks. v1.0.6 is out now, which reverts #19

from toposort.

sumbad avatar sumbad commented on September 23, 2024 33

@WiseBird I found that error happiness if html-webpack-plugin uses default chunksSortMode parameter.
For example, you can change it in the following way:

new HtmlWebpackPlugin({
     "template": "./src/index.html",
     "filename": "./index.html",
     "hash": false,
     "inject": true,
     "compile": true,
     "favicon": false,
     "minify": false,
     "cache": true,
     "showErrors": true,
     "chunks": "all",
     "excludeChunks": [],
     "title": "Webpack App",
     "xhtml": true,
     "chunksSortMode": 'none'
   }
 }),

Or use your special function. For example:

const entryPoints = ["inline","polyfills","sw-register","styles","vendor","main"];
...
chunksSortMode: function sort(left, right) {
  let leftIndex = entryPoints.indexOf(left.names[0]);
  let rightIndex = entryPoints.indexOf(right.names[0]);
  if (leftIndex > rightIndex) {
      return 1;
  }
  else if (leftIndex < rightIndex) {
      return -1;
  }
  else {
      return 0;
  }
}
...

from toposort.

xzilja avatar xzilja commented on September 23, 2024 12

throw new Error('Cyclic dependency: '+JSON.stringify(node)) and followed by same output as above.

Not much changed in terms of environment that this is ran in, hence pinpointing it down to latest release

from toposort.

hpwilliams avatar hpwilliams commented on September 23, 2024 8

Thanks for quick turnaround!

from toposort.

denov avatar denov commented on September 23, 2024 6

i'm seeing this error with 1.0.7 in a dojo project

$ npm list toposort
[email protected] C:\development\projects\xxx\project
`-- @dojo/[email protected]
  `-- [email protected]
    `-- [email protected]

change chucksSortMode to none fixes it

from toposort.

soulofmischief avatar soulofmischief commented on September 23, 2024 3

I also get this error without specifying chunksSortMode as none.

from toposort.

xzilja avatar xzilja commented on September 23, 2024 2

@seanlandsman I think webpack is whats failing us as well, how did you downgrade toposort for it specifically? Never did it before for specific packages, would be cool to know :)

from toposort.

aPoCoMiLogin avatar aPoCoMiLogin commented on September 23, 2024 2

npm install [email protected]

from toposort.

marcelklehr avatar marcelklehr commented on September 23, 2024 2

@laurentpayot there already is one: jantimon/html-webpack-plugin#870 ;)

from toposort.

clubajax avatar clubajax commented on September 23, 2024 1

I'm using yarn, and added this to my package.json:

"resolutions": {
	"toposort": "1.0.4"
}

from toposort.

philjones88 avatar philjones88 commented on September 23, 2024 1

+1 not too happy, respect semver! :(

from toposort.

WiseBird avatar WiseBird commented on September 23, 2024 1

Reproduction in case anyone needs it. Error is thrown when building angular app in AoT mode.

from toposort.

petergaal91 avatar petergaal91 commented on September 23, 2024

+1

from toposort.

ET-1992 avatar ET-1992 commented on September 23, 2024

+1

from toposort.

seanlandsman avatar seanlandsman commented on September 23, 2024

For me too - the fix on my side was to downgrade the version of toposort to 1.0.4.

I didn't actually reference this dependency directly - webpack does - just fyi.

from toposort.

hstaniszewski avatar hstaniszewski commented on September 23, 2024

+1

from toposort.

evanjmg avatar evanjmg commented on September 23, 2024

+1 - affects html webpack plugin

from toposort.

GurpreetSran avatar GurpreetSran commented on September 23, 2024

+1

from toposort.

justboras avatar justboras commented on September 23, 2024

+1

from toposort.

Yantrio avatar Yantrio commented on September 23, 2024

We're also hitting this. :(

from toposort.

seanlandsman avatar seanlandsman commented on September 23, 2024

@iljadaderko I added this to package.json

"toposort":"1.0.4"

thanks

from toposort.

hlodver avatar hlodver commented on September 23, 2024

+1

from toposort.

timwoodart avatar timwoodart commented on September 23, 2024

+1

from toposort.

kasparasg avatar kasparasg commented on September 23, 2024

+1

from toposort.

serhiizx avatar serhiizx commented on September 23, 2024

+1

from toposort.

apphelpyulongs avatar apphelpyulongs commented on September 23, 2024

thanks for the quick fix. Our production build failed yesterday since it's the dependency of html-webpack-plugin

from toposort.

adityavm avatar adityavm commented on September 23, 2024

UPDATE: there's a workaround provided in jantimon/html-webpack-plugin#870 which is working for me at the moment. I'm leaving this comment up in case anybody else is affected.

I'm currently hitting this error in 1.0.6 too (through html-webpack-plugin).

> npm list toposort
[email protected] /Users/aditya/dev/rekrn
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

I made a new and clean repo to try and reproduce it but wasn't able to:

> npm list toposort
[email protected] /Users/aditya/dev/testwebpack4
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

Any help will be appreciated.

Full error dump:

 95% emitting HtmlWebpackPlugin/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/node_modules/toposort/index.js:29
      throw new Error('Cyclic dependency: '+JSON.stringify(node))
                                                 ^

TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at visit (/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/node_modules/toposort/index.js:29:50)
    at visit (/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/node_modules/toposort/index.js:47:9)
    at visit (/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/node_modules/toposort/index.js:47:9)
    at visit (/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/node_modules/toposort/index.js:47:9)
    at Function.toposort [as array] (/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/node_modules/toposort/index.js:22:22)
    at Object.module.exports.dependency (/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/lib/chunksorter.js:50:35)
    at HtmlWebpackPlugin.sortChunks (/Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/index.js:364:35)
    at /Users/aditya/dev/rekrn/node_modules/html-webpack-plugin/index.js:113:21
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/aditya/dev/rekrn/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:14:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/aditya/dev/rekrn/node_modules/tapable/lib/Hook.js:35:21)
    at Compiler.emitAssets (/Users/aditya/dev/rekrn/node_modules/webpack/lib/Compiler.js:305:19)
    at onCompiled (/Users/aditya/dev/rekrn/node_modules/webpack/lib/Watching.js:50:19)
    at hooks.afterCompile.callAsync.err (/Users/aditya/dev/rekrn/node_modules/webpack/lib/Compiler.js:485:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/aditya/dev/rekrn/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/aditya/dev/rekrn/node_modules/tapable/lib/Hook.js:35:21)

from toposort.

marcelklehr avatar marcelklehr commented on September 23, 2024

Sorry for my absence. Can you reproduce this with toposort only? Alternatively, what does the dependency graph look like?

from toposort.

marcelklehr avatar marcelklehr commented on September 23, 2024

So, when I run the build script for the reproduction repo, I get the following edges of the dependency graph:

5005 => 5004,
5003 => 5004,
5004 => 5005,
5003 => 5005

Clearly, there is a cyclic dependency between 5005 and 5004. The only "bug" in toposort, is the type error, if you will, which I'll fix now. :)

from toposort.

laurentpayot avatar laurentpayot commented on September 23, 2024

I found that error happiness if html-webpack-plugin uses default chunksSortMode parameter.

@sumbad do you mean that this cyclic dependency error does not occur when chunksSortMode option of HtmlWebpackPlugin is set to 'none'?
If that's what you mean then it's the same for me since I switched to webpack 4.

Should we open an HtmlWebpackPlugin issue?

from toposort.

smxyzb avatar smxyzb commented on September 23, 2024

@WiseBird I found that error happiness if html-webpack-plugin uses default chunksSortMode parameter.
For example, you can change it in the following way:

new HtmlWebpackPlugin({
     "template": "./src/index.html",
     "filename": "./index.html",
     "hash": false,
     "inject": true,
     "compile": true,
     "favicon": false,
     "minify": false,
     "cache": true,
     "showErrors": true,
     "chunks": "all",
     "excludeChunks": [],
     "title": "Webpack App",
     "xhtml": true,
     "chunksSortMode": 'none'
   }
 }),

Or use your special function. For example:

const entryPoints = ["inline","polyfills","sw-register","styles","vendor","main"];
...
chunksSortMode: function sort(left, right) {
  let leftIndex = entryPoints.indexOf(left.names[0]);
  let rightIndex = entryPoints.indexOf(right.names[0]);
  if (leftIndex > rightIndex) {
      return 1;
  }
  else if (leftIndex < rightIndex) {
      return -1;
  }
  else {
      return 0;
  }
}
...

厉害了我的哥

from toposort.

vindyala avatar vindyala commented on September 23, 2024

@WiseBird I found that error happiness if html-webpack-plugin uses default chunksSortMode parameter.
For example, you can change it in the following way:

new HtmlWebpackPlugin({
     "template": "./src/index.html",
     "filename": "./index.html",
     "hash": false,
     "inject": true,
     "compile": true,
     "favicon": false,
     "minify": false,
     "cache": true,
     "showErrors": true,
     "chunks": "all",
     "excludeChunks": [],
     "title": "Webpack App",
     "xhtml": true,
     "chunksSortMode": 'none'
   }
 }),

Or use your special function. For example:

const entryPoints = ["inline","polyfills","sw-register","styles","vendor","main"];
...
chunksSortMode: function sort(left, right) {
  let leftIndex = entryPoints.indexOf(left.names[0]);
  let rightIndex = entryPoints.indexOf(right.names[0]);
  if (leftIndex > rightIndex) {
      return 1;
  }
  else if (leftIndex < rightIndex) {
      return -1;
  }
  else {
      return 0;
  }
}
...

yes, change to chucksSortMode to none in webpack config file fixes it

from toposort.

Related Issues (16)

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.