-
Notifications
You must be signed in to change notification settings - Fork 47
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
[Feature request ] Support pnp Yarn 2 resolution - "Error: Can't find stylesheet to import." #60
Comments
I'm curious how that will work. PR welcome 😉 |
I find myself in a similar situation, but I'm not entirely sure how it would be addressed. Based on my knowledge, in order to get a file or package when using Yarn PnP, the script in question needs to Even barring that however, Yarn PnP has another problem that currently has a workaround, but the Yarn team has stated is going away eventually. Yarn really doesn't want any package accessing any package or file that it doesn't explicitly list as a dependency. Currently, in the I honestly find myself at a loss here. I suppose an idea could be to attempt to load file as the plugin is doing now, and then attempt to |
Turns out, |
I have an update. The solution I have in mind will work, but it doesn't work versions of const css = sass.renderSync(Object.assign({
data: prefix + scss,
includePaths
}, options)).css.toString() needs to change to this: const css = sass.renderSync(Object.assign({
data: prefix + scss,
includePaths,
importer: (url, prev, done) => {
const resolved;
if (fs.existsSync(url)) {
resolved = url;
} else {
const finalUrl = url.startsWith('~') ? url.replace('~', '') : url
resolved = require.resolve(finalUrl)
}
done({ file: resolved })
}
}, options)).css.toString()
Update: I have tested it...and it works! I will rebase, squash and submit a PR. This is the final TypeScript code, sorry for the messiness. I didn't want to type this to either const render = sass.renderSync(
Object.assign(
{
data: prefix + scss,
outFile: dest,
includePaths,
importer: (url: string, prev: string, done: (data: { file: string } | { contents: string } | Error | null) => void): { file: string } | { contents: string } | Error | null | void => {
let resolved;
if (existsSync(url)) {
resolved = url;
} else {
const finalUrl = url.startsWith('~') ? url.replace('~', '') : url
resolved = require.resolve(finalUrl)
}
return { file: resolved }
}
},
options
)
) |
Like sass-loader,
Support @workspace/module pnp node-module resolution
Similar "vercel/next.js#15753"
The text was updated successfully, but these errors were encountered: