web icon indicating copy to clipboard operation
web copied to clipboard

[dev-server-core] can't load test-helpers as esm/mjs

Open tlouisse opened this issue 3 years ago • 0 comments

When I use import { createTestServer } from '@web/dev-server-core/test-helpers';, createTestServer returns undefined.

This is because it tries to get it from ./dist/index.js, which should be ./dist/test-helpers.js: https://github.com/modernweb-dev/web/blob/master/packages/dev-server-core/test-helpers.mjs#L2

It can be fixed here, by returning import cjsEntrypoint from '{exportedFile}' : https://github.com/modernweb-dev/web/blob/master/scripts/generate-mjs-dts-entrypoints.mjs#L51

tlouisse avatar Dec 03 '21 21:12 tlouisse