Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncareted sanitize.css dependency causing failure while requiring postcss-normalize #58

Closed
10hendersonm opened this issue Sep 14, 2021 · 16 comments · Fixed by #60
Closed

Comments

@10hendersonm
Copy link

10hendersonm commented Sep 14, 2021

[email protected] removes file page.css, which is directly referenced in cssMap.js:

const sanitizePageCSS = resolve('sanitize.css/page.css')

As sanitize.css is installed at version * rather than something like 12.0.0 or ^12.0.0, npm users are auto-upgraded into this breaking sanitize.css version. This includes users of create-react-app's react-scripts.

@avin
Copy link

avin commented Sep 14, 2021

temp solution for package.json

  "scripts": {
     ...
    "preinstall": "npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions"
  }, 
  ...
  "resolutions": {
    "sanitize.css": "12.0.1"
  }

@jonathantneal
Copy link
Collaborator

So, @10hendersonm, would an appropriate solution be to protect that code from throwing and releasing that in patch today? Or to force page.css back into sanitize.css?

I can definitely "coordinate" this.

@10hendersonm
Copy link
Author

I'll be 100% honest that this isn't my usual space. I dropped a PR (#59) but haven't had a chance to check this repo's normal workflows yet to see if I missed any other requirements.

@10hendersonm
Copy link
Author

10hendersonm commented Sep 14, 2021

Oh, hah, @jonathantneal I didn't realize you have sanitize.css as well. You can either code around the removed file, pin this back to the previous sanitize.css version, add it back in sanitize.css, etc. I'm cool with anything, I just don't have direct access to this level of dependencies as npm doesn't have resolutions yet without additional tooling (thanks @avin)

@DavidHenri008
Copy link

I was also having the same problem where the sanitiza.css was somehow not found. The suggested workaround worked for me.

@rajrajhans
Copy link
Contributor

rajrajhans commented Sep 15, 2021

Can confirm this issue causes create-react-app to fail, giving the following error on start or build:

ERROR in ./src/index.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/react-scripts/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_module

Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'sanitize.css/page.css'
Require stack:
- ... \node_modules\react-scripts\node_modules\postcss-normalize\index.cjs

@LQ0611
Copy link

LQ0611 commented Sep 15, 2021

I have the same question :'cannot find module ‘sanitize.css/page.css’'

@rajrajhans
Copy link
Contributor

@LQ0611 for now, a temporary fix would be to pin sanitize.css to 12.0.1.

Add this in your package.json

"resolutions": {
   "sanitize.css": "12.0.1"
}

@LQ0611
Copy link

LQ0611 commented Sep 15, 2021 via email

@yoyo837
Copy link

yoyo837 commented Sep 15, 2021

@LQ0611 for now, a temporary fix would be to pin sanitize.css to 12.0.1.

Add this in your package.json

"resolutions": {
   "sanitize.css": "12.0.1"
}

It only works on yarn.

@yoyo837
Copy link

yoyo837 commented Sep 15, 2021

@LQ0611
Copy link

LQ0611 commented Sep 15, 2021

yeah,' resolutions' is a temporary way, of course , the base way is that the problem is resolved by owner , hahaha

@LQ0611
Copy link

LQ0611 commented Sep 15, 2021

Vote this 😄

1,maybe someone useing pages.css?

@10hendersonm
Copy link
Author

Without updating the sanitize.css dependency semver range, does this in essence prevent sanitize.css from ever being allowed to breaking change again?

@bmuenzenmeyer
Copy link

the right thing to do is revisit https://github.com/csstools/postcss-normalize/blob/HEAD/CHANGELOG.md#900-april-12-2020 which introduced the * dependency concept. we have goodwill semver releases like https://github.com/csstools/sanitize.css/releases/tag/v13.0.0 that unintentionally broke downstream

@jonathantneal
Copy link
Collaborator

@bmuenzenmeyer, aye. For now, I’m side-stepping the issue by using path.join rather than resolve to prevent throws.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants