-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Use require.resolve to find CSS modules in node_modules #79651
Use require.resolve to find CSS modules in node_modules #79651
Conversation
This builds fine now when I run |
use require.resolve via a module proxy and mark it as a commonjs external in webpack config
a1811cd
to
7114b57
Compare
Confirmed this is working in the dev build ( |
import { existsSync } from 'fs'; | ||
|
||
const resolve = require('requireresolveproxy'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is using require rather than import due to not having .ts typings for requireresolveproxy - happy to resolve in another way if someone can suggest how
…ort-requireresolveproxy
Pretty sure the failing CI is unrelated to this PR
|
That's the test that I added for the node module resolving. |
Replaced by #81555 |
Further to #70693 which was reworked by @aeschli in 8f72934 due to issues with require.resolve and webpack.
Fixes #78894
Fixes microsoft/vscode-css-languageservice#136
The current implementation of resolving the path to a CSS module in node_modules has significant limitations.
Using require.resolve directly should be the most solid approach but can't be used in code that is webpacked.
This PR allows us to use require.resolve via a module proxy (requireresolveproxy) and marking the module as a commonjs external in the webpack config.
Potential alternative approaches: