Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find exports from Typescript library BlueprintJS #520

Open
superslau opened this issue Oct 11, 2018 · 2 comments
Open

Cannot find exports from Typescript library BlueprintJS #520

superslau opened this issue Oct 11, 2018 · 2 comments

Comments

@superslau
Copy link

I'm using a UI library called BlueprintJS https://github.com/palantir/blueprint, and I'm having trouble using import-js with blueprint.

package.json:

  "dependencies": {
    "@blueprintjs/core": "^3.5.1",
    "@blueprintjs/select": "^3.2.0",
    ...
  }

The main entry point for @blueprintjs/core is lib/cjs/index.js which looks like:

"use strict";
/*
 * Copyright 2015 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the terms of the LICENSE file distributed with this project.
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./accessibility"), exports);
tslib_1.__exportStar(require("./common"), exports);
tslib_1.__exportStar(require("./components"), exports);
//# sourceMappingURL=index.js.map% 

The only export that gets picked up is __esModule

This is the compiled form of: https://github.com/palantir/blueprint/blob/develop/packages/core/src/index.ts

/*
* Copyright 2015 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/

export * from "./accessibility";
export * from "./common";
export * from "./components";

Having dug around findExports.js I can see the typescript support expects a typescript file, and not compiled typescript files.

How might we be able to add support for this?

@trotzig
Copy link
Collaborator

trotzig commented Oct 11, 2018

Hi @superslau, and thanks for the report! These types of issues can usually be solved by first adding a new test to lib/__tests__/findExports-test.js then modifying code in lib/findExports.js until the test passes. Here's a commit that can be used as inspiration: 828b46a

Run npm run jest --watch findExports to get quick feedback on code changes.

@superslau
Copy link
Author

superslau commented Oct 11, 2018

@trotzig Thanks, I'll give it a go this weekend. For now I'm heavily abusing namedExports :)

This was referenced Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants