Skip to content

fix: '__exportStar undefined'#8591

Closed
vtrifonov wants to merge 1 commit into
masterfrom
trifonov/fix-typescript-exportstar
Closed

fix: '__exportStar undefined'#8591
vtrifonov wants to merge 1 commit into
masterfrom
trifonov/fix-typescript-exportstar

Conversation

@vtrifonov
Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

When using typescript version 3.9.3 the generated files in the tns-core-modules package look like:

Object.defineProperty(exports, “__esModule”, { value: true });
__exportStar(require(@nativescript/core/application/application”), exports);

and for the older versions it looks like:

function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("@nativescript/core/application/application"));

The problem is that if we register __exportStar function in the ts-helpers.ts file which is called inside the application module, but if we load the application through the tns-core-modules package like this:

import * as application from "tns-core-modules/application";

this will call the code in the beginning and there will be no __exportStar yet.

What is the new behavior?

To fix that I've added the compiled js content inside the tns-core-modules-package/application/ folder and ignored the application/application.ts in package's tsconfig.json file as I have the js file already. In that js file, I'm requiring the ts-hepers module which will register the needed __exportStar function.

Fixes #8590.

@NathanWalker
Copy link
Copy Markdown
Contributor

We're holding on 3.9.3 ts support until some other framework integrations catch up.

@NathanWalker
Copy link
Copy Markdown
Contributor

NathanWalker commented Jul 10, 2020

This workaround will no longer be needed given #8693 refactors entire codebase to work with TS 3.9 and beyond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Building the modules with typescript version 3.9.3 and running some aps can cause '__exportStar undefined' runtime error

2 participants