Answer the question
In order to leave comments, you need to log in
Typescript and exports - how to build for a browser without webpack?
Hello. I have a typescript project. When I compile it, there are no problems - all js files are generated. However, this does not work in the browser due to a bug with exports:
Uncaught ReferenceError: exports is not defined
Object.defineProperty(exports, "__esModule", { value: true });
import ... from "..."
(<any>window)["uikit"] = UIkit;
///<reference path="..." />
, when you also need to put System for module in tsconfig. It works. However, this takes away the ability to do this:
Because of the way d.ts is written for uikit (taken from @types/uikit with npm), there is no other way to use it. It is supposed to be imported, not referenced. So, although I like references, typedefs of other people's libraries do not allow me to use them normally.
I tried including core-js as well as commonjs, but they didn't change anything either.
Maybe there is some way out that I don't see? Thanks in advance. import UIkit from "uikit";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question