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

fix: maintain require() compatibility for filters #1256

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

colinrotherham
Copy link
Contributor

This fix addresses an issue raised on Slack

I've added a workaround to keep the moj/filters/all export working whilst we look at:

Module resolution

For example, Node.js can't resolve moj/filters/all

node --eval "console.log(require.resolve('@ministryofjustice/frontend/moj/filters/all'))"

But it can resolve moj/filters/all.js

node --eval "console.log(require.resolve('@ministryofjustice/frontend/moj/filters/all.js'))"

This is caused by both Package entry point "exports" in package.json and Node.js mandatory file extensions

Outdated examples

Both of these examples will need updating in #1249

let mojFilters = require('./node_modules/@ministryofjustice/frontend/filters/all')();

let mojFilters = require('./node_modules/@ministryofjustice/frontend/filters/all')();

@colinrotherham colinrotherham merged commit b25ec12 into main Mar 10, 2025
12 checks passed
@colinrotherham colinrotherham deleted the subpath-exports branch March 10, 2025 09:56
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

Successfully merging this pull request may close these issues.

2 participants