Skip to content

Commit

Permalink
Fix error when importing from ESM auto entrypoint (#422)
Browse files Browse the repository at this point in the history
* Fix error when importing from ESM auto entrypoint

* Skip full lib check in TypeScript verification

happy-dom has some issues in their typings unrelated to what's used in our project

Per documentation, this also "can save time during compilation at the expense of type-system accuracy"

See: https://www.typescriptlang.org/tsconfig#skipLibCheck
  • Loading branch information
aduth authored Mar 6, 2024
1 parent 09d16b1 commit 362a4d3
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

- Add missing JavaScript exports for `button`, `inPageNavigation`, `inputMask`, `languageSelector`, and `range`. ([#407](https://github.com/18F/identity-design-system/pull/407))
- Fix `dist/assets/js/main.js` compilation to properly consider browser support. ([#421](https://github.com/18F/identity-design-system/pull/421))
- Fix strict ES Module import errors due to lack of fully-qualified file path when importing `auto` entrypoint. ([#422](https://github.com/18F/identity-design-system/pull/422))

### Internal

Expand Down
79 changes: 79 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"@18f/eslint-plugin-identity": "^2.0.0",
"@18f/identity-build-sass": "^3.0.0",
"@18f/identity-stylelint-config": "^4.0.0",
"@happy-dom/global-registrator": "^13.6.2",
"@types/html_codesniffer": "^2.5.4",
"@types/pixelmatch": "^5.2.6",
"@types/pngjs": "^6.0.4",
Expand Down
2 changes: 1 addition & 1 deletion src/js/auto.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as components from './components';
import * as components from './components/index.js';

function initComponents() {
const target = document.body;
Expand Down
23 changes: 23 additions & 0 deletions test/imports.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable import/no-unresolved */

import { describe, before, after, it } from 'node:test';
import { GlobalRegistrator } from '@happy-dom/global-registrator';

describe('imports', () => {
before(() => {
GlobalRegistrator.register();
});

after(() => {
GlobalRegistrator.unregister();
});

it('imports from all entrypoints without errors', async () => {
await Promise.all([
// @ts-ignore
import('@18f/identity-design-system'),
// @ts-ignore
import('@18f/identity-design-system/auto'),
]);
});
});
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"noEmit": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node",
"module": "ESNext",
"target": "ESNext",
Expand Down

0 comments on commit 362a4d3

Please sign in to comment.