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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
require('css-functions-list')
returns "/index.json"
#2
Comments
Here is where it fails in the codebase Here is the error in CircleCI |
I've also open an issue on the stylelint repo stylelint/stylelint#5904 |
I think this is related to how Jest handles As for similar issue in Stylelint repo, that issue was solved using |
Thank you for your answer and I understand. I've look around a bit and I found that it might also be related to
Issue following jest ESM support |
@100terres just tried importing module with ESM and CommonJS approach鈥攂oth work as expected. This is probably something unrelated to how this module exports path to JSON, otherwise this wouldn鈥檛 work in Stylelint. README contains example on how to consume JSON file. Sorry if this isn鈥檛 working with you. If there is more reported cases of this "problem", I will see if I can approach this differently (in fact, I can, but I鈥檓 trying to follow ESM specification). Otherwise, this stays as it is. |
@100terres new version has been published where I鈥檝e changed the way JSON file is resolved, could you try again? |
Hi @niksy here's my follow up on this issue in the stylelint repo stylelint/stylelint#5904 (comment) |
Hi! 馃檪
I'm running into an issue where we are not able to load the
index.json
from the root of this package, because when requiring the package it returns"/index.json"
which the right relative or absolute path.The issue I'm describing happens when using the
stylelint@v14.5.0
node API in ajest@v26.6.3
test withnode@v14.18.2
. (On ubuntu 20.04)EDIT: It's also uder
TypeScript@4.5.5
with babelstylelint
recently added this newfunction-no-unknown
rule which uses under the hood thecss-functions-list
package here:It was introduced in this PR
When I execute my code using the
function-no-unknown
(that was enabled in thestylelint-config-recommended
package here) it throws this errorWhich is a similar to error raised by someone in the PR stylelint/stylelint#5865 (comment)
I've found a way to make it work using
path.resolve
instead of thenew URL
here and directly use the returns ofrequire("css-functions-list")
hereWould it make sens to use the
path.resolve
instead?The text was updated successfully, but these errors were encountered: