You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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"
Any idea how to import tko in an ES Module?
Thanks!
mario
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:Tried also with the other library
build.reference.js:
with identical results. BTW, isbuild.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.
The text was updated successfully, but these errors were encountered: