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

Support .cjs extension #249

Open
aciccarello opened this issue Oct 28, 2024 · 0 comments
Open

Support .cjs extension #249

aciccarello opened this issue Oct 28, 2024 · 0 comments

Comments

@aciccarello
Copy link

In a project with a package.json set to "type": "module", node changes their file interpretation to ESM. If I want to keep my pa11y JS config the same, I tried to use the .cjs extension to have Node parse the file as commonjs. But it seems like pa11y is trying to interpret the file as JSON and failing.

> pa11y-ci -c _build/tests/pa11y.cjs

There was a problem loading "/Users/ajciccarello/project/_build/tests/pa11y.cjs":
SyntaxError: Unexpected token 'c', "const test"... is not valid JSON
    at JSON.parse (<anonymous>)
    at loadLocalConfigUnmodified (/Users/ajciccarello/project/node_modules/pa11y-ci/bin/pa11y-ci.js:165:15)
    at /Users/ajciccarello/project/node_modules/pa11y-ci/bin/pa11y-ci.js:124:13
    at new Promise (<anonymous>)
    at loadConfig (/Users/ajciccarello/project/node_modules/pa11y-ci/bin/pa11y-ci.js:120:9)
    at /Users/ajciccarello/project/node_modules/pa11y-ci/bin/pa11y-ci.js:70:10
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant