Building esm (unbundled) .js file extension issue

Author: foobarbecueCreated Jan 18, 2026Updated Jan 31, 2026

I was trying to use golden-layout (both version 2.6 and the dev branch) by running npm run build and then importing from an html file with:

    <script type="module">
        import { GoldenLayout } from './dist/esm/index.js';
        ...
    </script>

This fails with lots of 404 errors because index.js looks like:

export * from './ts/config/config';
export * from './ts/config/resolved-config';
export { ComponentContainer } from './ts/container/component-container';
export { BrowserPopout } from './ts/controls/browser-popout';
...

, but all the files are actually .js, e.g. ./ts/config/config.js .

This was easy to fix using npx fix-esm-import-path dist and there's also an easy workaround of using the bundled build (npm run build:bundles), but that wasn't immediately obvious. I think this sort of thing can impede developer participation so should be fixed unless I'm missing something. I'm only moderately experienced with js build tools. I can volunteer to PR this as a first issue if desired since it seems pretty straightforward.

Source: golden-layout/golden-layout