Skip to content

Unable to load from an ES module #158

Open
@crystalfp

Description

@crystalfp

I'm in the process of modernizing my application moving it from AMD to ES modules. With the classic KO that was not possible and someone suggested to move to TKO, so I installed 4.0.0-alpha9.0.

I'm using the importmap (https://wicg.github.io/import-maps/) that is implemented in Chrome to map from "knockout" to the
"../node_modules/@tko/build.reference/dist/build.reference.es6.js" library.

Loading TKO this way: import ko from "knockout"; now gives a runtime error:
Uncaught SyntaxError: The requested module 'knockout' does not provide an export named 'default'

Loading that way: import * as ko from "knockout"; gives a different runtime error:

build.reference.es6.js:10 Uncaught TypeError: Cannot set properties of
undefined (setting 'ko')
    at build.reference.es6.js:10
    at build.reference.es6.js:11

Tried also with the other library build.reference.js: with identical results. BTW, is build.reference.es6.js the library that supports ES modules?

The modules are compiled from Typescript, but don't think this is relevant here.

Thanks for your help. I'm quite desperate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions