Cyclic dependency error when using "polymerx watch" in a legacy "polymer serve" project #179
Comments
Hi @TimPietrusky I'm really glad the CLI is helping you moving forward! Your detailed explain is really helpful. I'm wondering if I can fix this problem with some sort of check. Can you help me figuring out what's the cause of this problem in a legacy project? Also for mentioning some resources within the README if I can't find a better solution. Thank you so much anyway 👍 |
My original goal was to be as standard compliant as possible, meaning having no build tools and only imports of absolute paths. I ported a lot of modules into ES6, but at some point this was not working anymore. So I had to switch to import module from '/src/components/module.js' And I could use modules, that were not possible to convert, because they didn't provide a default / named export like this: // my-global-module.js
export default globalModule = window.globalModule
// index.js
// Load the new module into something else
import globalModule from '/src/libs/globalModule.js' Inside index.html I was loading these things into global scope. BUT when switching to PolymerX CLI this was producing cyclic dependecy errors. So what I'm doing right now is to get rid of all the "ported" modules and import them for real from node_modules AND remove the Does this answer your question? If not then I will show you the PR with all the changes I have to do WHEN it's ready. |
This problem is related to jantimon/html-webpack-plugin#870 and might be fixed in a newer version of |
Anyway, you can find the changes that I had to do in order to resolve the problem. I also used the opportunity to delete stuff and move into a structure as you have defined it in the default skeleton. The important bits are the changes: NERDDISCO/luminave@934f177 |
Pretty detailed! Thank you so much for your time @TimPietrusky. After all I think the current solution here is, as you said, to mention the problem on the README in a section related to What do you think? It's enough, currently, to add the details within the README? EDIT: just opened a PR with that changes, take a look: https://github.com/PolymerX/polymerx-cli/pull/185/files |
@LasaleFamine thank you super much for being that fast in solving this issue! |
I want to move away from
polymer serve
because I need something that can build and bundle everything on the fly and that is just not possible withpolymer serve
. So I was trying to use polymerx (which is SUPER awesome, thank you!!!) and ran into a problem after doing these steps:polymerx create default luminave
npm run dev
and got this error:/usr/local/lib/node_modules/polymerx-cli/node_modules/toposort/index.js:35 throw new Error('Cyclic dependency' + nodeRep) ^ Error: Cyclic dependency
This was killing the process and giving me nothing to work with. So I had to create
polymerx.config.js
, added it to the dev commandpolymerx watch -c polymerx.config.js
with this content:This makes sure to disable the
chunksSortMode
bytoposort
which is used by the HtmlWebpackPlugin. After this I saw many errors in the console with dependencies that were shit and I could fix all of them.Now my project is running with polymerx (YAAAAAAAY).
I think it would be nice to mention this somewhere, if someone might want to migrate a "legacy" (a project build on the https://github.com/Polymer/pwa-starter-kit + polymer serve) to use with PolymerX CLI.
The text was updated successfully, but these errors were encountered: