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

Unable to import Bezier: 'Bezier' is not exported from 'bezier-js'. #164

Open
baughmann opened this issue Nov 14, 2021 · 3 comments
Open
Labels
needs verification This may or may not be related to the library itself

Comments

@baughmann
Copy link

Description

  1. Created a new React application with create-react-app using the typescript template
    • Removed unnecessary packages and files
  2. Added bezier-js via npm
  3. Added declare module "bezier-js" to react-app-env.d.ts
  4. Added the following to index.tsx:
    import { Bezier } from "bezier-js";
    // ...
    const it = new Bezier();
    console.log(it);
    
  5. Am greeted by contents of the attached screenshot: Screen Shot 2021-11-14 at 3 11 48 PM

Steps to reproduce

The following steps will assist you in cloning the reproducible example project.

  1. git clone https://github.com/baughmann/bezier-js-issue
  2. cd bezier-js-issue
  3. npm i && npm start
@Pomax
Copy link
Owner

Pomax commented Jan 2, 2022

To address the original question that led to this issue: which version of Node are you using for this? Because this library declares two points of use:

  "exports": {
    "import": "./src/bezier.js",
    "require": "./dist/bezier.cjs"
  },

I.e. the dist version of the library is the legacy commonjs code, which doesn't use import/export.

Also, if I run this as plain JS, things seem to work perfectly fine, so this might be related to how you're trying to load TS definitions on top of a plain JS library - unfortunately I have zero TS experience so someone else may have to help you out. If you can reduce this to a true minimal reproducible form your best bet is probably Stackoverflow here.

@Pomax Pomax added needs verification This may or may not be related to the library itself and removed bug labels Jan 2, 2022
@richardk123
Copy link

@Pomax
Copy link
Owner

Pomax commented Oct 2, 2022

@richardk123 that's a closed issue, want to summarize it? (there's a lot of discussion in it, so if there's some useful information in there that pertains to this library, please repost that information here, instead of just linking out without anything to tell me what you want me to do with that link =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs verification This may or may not be related to the library itself
Projects
None yet
Development

No branches or pull requests

3 participants