Support for yarn

Frontity Roadmap :biking_man:

Feature Card

Description

Right now, yarn is not working because yarn doesn’t install local dependencies using symlinks. It copies the folder instead.


Using yarn to install dependencies will cause that npx frontity dev won’t reload automatically an updated version of your project when you change (and save) your code under the packages folder as this problem affects how the modules are linked.

If you have created your project with npx frontity create or you’re modifying an existing project, you may have some internal scripts to launch your project. npx run dev won’t work properly as well in most of these cases

When using yarn to install dependencies, the theme you install as a local package, for example…

"dependencies": {
   ...
    "@frontity/mars-theme": "./packages/mars-theme",
   ...
  },

is not linked to your local folder but copied instead. That provokes that changes you do under your packages folder are not detected by the local server that is launched when you do npx frontity dev (and that should reload automatically showing your latest changes when you change your code)

User stories

As a Frontity user
I want to use yarn instead of npm,
so that I can keep using the tools I prefer.

Possible solution

We can use symlink-dir at frontity dev.

Workaround

Use npm install instead of yarn.

Doing an npm install won’t work if you have already used yarn before. In that case, you must delete the node_modules folder and use npm install again.

I think this issue is causing problems for a lot of early adopters as a lot of people use yarn by default

I also think this problem is giving a very bad feeling when trying Frontity for the first time as things doesn’t work and it is not clear why

Is there any way we could warn the user about this, or forbidding the use of yarn, or any other solution so we can avoid this problem to the early adopters?

Here you can see a comparison of use of yarn vs npm → https://www.npmtrends.com/npm-vs-yarn

Once this is a priority I think it’s faster to actually fix the problem than to throw a warning.

1 Like

@SantosGuillamot opened a bug for this and it will be addressed before the next release: https://github.com/frontity/frontity/issues/364

This has been fixed in the last realese - Frontity release: Yarn now works with Frontity