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

the latest published ove package can not be imported correctly. #13

Closed
sunm19810-pki opened this issue Aug 14, 2023 · 8 comments
Closed

Comments

@sunm19810-pki
Copy link
Contributor

Hi @tnrich, it seems the latest 'ove' version (0.3.7) can not be imported correctly, can we publish the 'ove' package and other packages like 'ui' without 'react' or 'react-dom' bundled (open-vector-editor do not set these two packages in the dependencies, it set the two in the peerDependencies and devDependencies)

currently published npm packages can not be used as es module easily. Thanks

@tnrich
Copy link
Collaborator

tnrich commented Aug 14, 2023

Hi @sunm19810-pki ,

Version 0.3.7 seems to be working in this simple react demo page - https://github.com/tnrich/ove-react-demo-repo

Does that demo work for you? In what ways is your set up different from that one?

Thanks

@XingGao-PKI
Copy link
Contributor

@tnrich, it seems works fine with vite, but for webpack, it cannot load the the src/index.js as the source code
It always shows an error like this.

Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> import "@fontsource/ubuntu-mono";
| import { FocusStyleManager } from "@blueprintjs/core";
| import { showContextMenu } from "@teselagen/ui";

@XingGao-PKI
Copy link
Contributor

@tnrich you can try this repo
https://github.com/XingGao-PKI/my-app

@sunm19810-pki
Copy link
Contributor Author

Hi @tnrich, if we want to make the latest ove package been easily used in webpack, we may need to change some configurations in the vite.react.config.ts, maybe I can raise a PR tomorrow for it. Mainly need to change formats:, external of vite.react.config.ts file. And we need to change some value in publish.mjs to make the published package.json file able to be recognized as a es module.

@tnrich
Copy link
Collaborator

tnrich commented Aug 17, 2023

@sunm19810-pki thanks for looking into this. I'd be happy to review a PR if you make one.

@tnrich
Copy link
Collaborator

tnrich commented Aug 18, 2023

Ok, @XingGao-PKI @sunm19810-pki I published a new version of ove 0.3.9 that should work for vite and webpack builds. I added a vite and webpack demo to tg-oss

To try out the webpack demo within tg-oss run the following commands:

cd tg-oss;
yarn;
nx run:ove build; 
cd example-demos/oveWebpackDemo && yarn && yarn start

You should see something like this:
image

Lemme know if that works for y'all

@sunm19810-pki
Copy link
Contributor Author

Thanks very much @tnrich, it indeed work now. We actually had similar code PR for webpack building, but we decide to use the previous version as the new version may need some time, it is really good as the new version is published so fast.

@tnrich
Copy link
Collaborator

tnrich commented Aug 20, 2023

Awesome, glad to hear it!

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

3 participants