Skip to content

TypeError: Cannot set properties of undefined (setting 'ko') #159

@crystalfp

Description

@crystalfp

Still struggling to load tko in an ES module.

I have installed @tko/build.reference.
Then in my module I import it this way:

import * as ko from "./node_modules/@tko/build.reference/dist/build.reference.js";

But Chrome on Windows answers with:

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

The same happens if I load build.reference.es6.js

Anyway, if you edit the file (build.reference*.js) and at line 10 change global into globalThis the error disappears.

Done this dirty fix, and overcoming some Typescript peculiarity, seems TKO works.

Thanks for continued support to this wonderful library!
mario

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