You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The component JS files available within the packages folder of the nhsuk-frontend distribution are only available in ESM syntax. This causes an issue when the consuming application is not using the ESM module type (but for instance uses CJS instead).
In order to support CJS applications there should be CJS versions of these JS files available, either instead of ESM, or in addition to ESM (by using different entrypoints via package.json).
What steps are required to reproduce the issue?
Import one of the JS files in an application which requires CJS for it's dependencies. E.g.
import HeaderJs from 'nhsuk-frontend/packages/components/header/header';
The CJS loader will complain about unexpected export tokens - this is because it cannot handle ESM syntax.
Current workaround
The JS files need to be copied into the consuming application (rather than referencing the nhsuk-frontend dependency) so that they can be transpiled to CJS syntax when needed.
The text was updated successfully, but these errors were encountered:
What is the issue?
The component JS files available within the
packages
folder of the nhsuk-frontend distribution are only available in ESM syntax. This causes an issue when the consuming application is not using the ESM module type (but for instance uses CJS instead).In order to support CJS applications there should be CJS versions of these JS files available, either instead of ESM, or in addition to ESM (by using different entrypoints via package.json).
What steps are required to reproduce the issue?
Import one of the JS files in an application which requires CJS for it's dependencies. E.g.
The CJS loader will complain about unexpected export tokens - this is because it cannot handle ESM syntax.
Current workaround
The JS files need to be copied into the consuming application (rather than referencing the nhsuk-frontend dependency) so that they can be transpiled to CJS syntax when needed.
The text was updated successfully, but these errors were encountered: