Open crystalfp opened 2 years ago
Still struggling to load tko in an ES module.
I have installed @tko/build.reference. Then in my module I import it this way:
@tko/build.reference
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
build.reference.es6.js
Anyway, if you edit the file (build.reference*.js) and at line 10 change global into globalThis the error disappears.
build.reference*.js
global
globalThis
Done this dirty fix, and overcoming some Typescript peculiarity, seems TKO works.
Thanks for continued support to this wonderful library! mario
The real problem is that both typeof exports and typeof module are undefined, so I cannot import the library this way as expected: import tko from "..../build.reference.es6.js"
typeof exports
typeof module
import tko from "..../build.reference.es6.js"
Still struggling to load tko in an ES module.
I have installed
@tko/build.reference
. Then in my module I import it this way:But Chrome on Windows answers with:
The same happens if I load
build.reference.es6.js
Anyway, if you edit the file (
build.reference*.js
) and at line 10 changeglobal
intoglobalThis
the error disappears.Done this dirty fix, and overcoming some Typescript peculiarity, seems TKO works.
Thanks for continued support to this wonderful library! mario