1

Got a new job back in January. Our dependencies have not been well maintained, and given that the other developer's on vacation for a couple weeks, I've been given carte blanche to get our dependencies as up-to-date as I can in those two weeks.

I hit a bunch of our tooling dependencies this morning, and that went great. Now I'm trying to upgrade to the new Yarn with plug-n-play. (Do I really need to? No. But I want to.) I've already cleared up a bunch of not-properly-installed peer dependencies, but now I'm running into stylesheet issues while doing test builds.

The players: Yarn 3.6.0, Sass 1.63.3, Node 20.3.1, using what seems to be the default react-scripts build script from react-scripts 5.0.0.

The relevant stylesheet snippet (src/styles/grid.scss):

@import 'src/styles/variables';
@import 'src/styles/mixins';
@import '~@syncfusion/ej2-base/styles/material.css';
@import '~@syncfusion/ej2-buttons/styles/material.css';
@import '~@syncfusion/ej2-navigations/styles/material.css';
@import '~@syncfusion/ej2-popups/styles/material.css';
@import '~@syncfusion/ej2-react-grids/styles/material.css';

The build output:

Failed to compile.

Error: Can't resolve '~@syncfusion/ej2-navigations/styles/material.css' in 'src/styles'

Things I tried

I tried yarn unplugging the relevant dependencies (@syncfusion/ej2-base, @syncfusion/ej2-buttons, @syncfusion/ej2-navigations, @syncfusion/ej2-popups, @syncfusion/ej2-react-grids) but that doesn't seem to give me a stable location that I can reference.

Stripping the .css extension from those imports nets me a new and interesting error, so I don't think changing that is necessarily the way to go.

Failed to compile.

SassError: Can't find stylesheet to import.
  ╷
1 │ @import 'ej2-icons/styles/material.scss';
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  .yarn/cache/@syncfusion-ej2-base-npm-19.1.64-ceb12a3308-4fddcb9449.zip/node_modules/@syncfusion/ej2-base/styles/material.scss 1:9  @import
  src/styles/grid.scss 3:9                                                                                                           root stylesheet

Things that will probably work, but I'd rather have a better solution

Setting Yarn to nodeLinker: node-modules works, but if there's another solution I'd rather use that.

We already have a postinstall script that copies stuff from a module out into the regular filesystem, and updating that wouldn't be difficult. It's inelegant, though I'd be happier about it than the nodeLinker option.

Lego
  • 86
  • 1
  • 7

0 Answers0