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 ESM config file #250

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

Support ESM config file #250

aciccarello opened this issue Oct 28, 2024 · 0 comments

Comments

@aciccarello
Copy link

If the package.json "type" is set to "module", a js config file is interpreted as ESM. When required, the ESM module is readonly which causes problems for the defaulting code. pa11y-ci might also need to check the default export property rather than needing to export individual properties (rather than export const urls = [...]

> NODE_OPTIONS='--experimental-require-module' pa11y-ci -c _build/tests/pa11y.js

(node:2986) ExperimentalWarning: Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/ajciccarello/project/node_modules/pa11y-ci/bin/pa11y-ci.js:198
        config.urls = config.urls || [];
                    ^

TypeError: Cannot add property urls, object is not extensible
    at defaultConfig (/Users/ajciccarello/project/node_modules/pa11y-ci/bin/pa11y-ci.js:198:14)
    at /Users/ajciccarello/project/node_modules/pa11y-ci/bin/pa11y-ci.js:142:12
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.18.0
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