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

Problem importing packages on meteor 3.0-beta.7 #13091

Open
ponytojas opened this issue Apr 11, 2024 · 16 comments
Open

Problem importing packages on meteor 3.0-beta.7 #13091

ponytojas opened this issue Apr 11, 2024 · 16 comments
Milestone

Comments

@ponytojas
Copy link

I'm trying to use meteor3 (Windows 11 with WSL) to create an App with Kepler.GL 3 (minimun Node version 18)
Currently using the meteor 3.0-beta7 for this.

When trying to create the basic app based on the kepler's demo app, I'm getting multiple errors on importing packages.

Just showing one as example
image

I'm importing it in my code
image

And at least VSCode is correctly finding the dependency as show below
image

I have tried to use another Kepler.GL example with same result but different packages.

Thanks in advance.

@StorytellerCZ StorytellerCZ added this to the Release 3.0 milestone Apr 12, 2024
@StorytellerCZ
Copy link
Collaborator

I wonder if it is not this issue: #11727
How is the package build output. Is it CJS or ESM? Can you check the package package.json for export field?

@ponytojas
Copy link
Author

I wonder if it is not this issue: #11727 How is the package build output. Is it CJS or ESM? Can you check the package package.json for export field?

Thanks for the answering.

Not export field in the package.json and using just check that are using babel with CJS dependencies, so I will assume it's CJS.

@nachocodoner
Copy link
Member

Could you provide a concise repository with the necessary code and setup to replicate the issue?

@StorytellerCZ
Copy link
Collaborator

Another thing you can try is to recompile the package with Meteor. You put something like this into package.json:

{
  "meteor": {
    "nodeModules": {
      "recompile": {
        "filestack-js": true
      }
    }
  }
}

@ponytojas
Copy link
Author

Could you provide a concise repository with the necessary code and setup to replicate the issue?

Yes, here it is
https://github.com/ponytojas/meteor3-kepler3-test

Another thing you can try is to recompile the package with Meteor. You put something like this into package.json:

I've tried but still having the same issues

@denihs
Copy link
Contributor

denihs commented Apr 12, 2024

Could you try @StorytellerCZ's solution but following the docs? I think you need to specify the bundles.

@ponytojas
Copy link
Author

Could you try @StorytellerCZ's solution but following the docs? I think you need to specify the bundles.

Tried setting ['legacy', 'client'] too and have the same problem, don't know if it's what you're referring about.

@nachocodoner
Copy link
Member

nachocodoner commented Apr 15, 2024

Could you provide a concise repository with the necessary code and setup to replicate the issue?

Yes, here it is ponytojas/meteor3-kepler3-test

Another thing you can try is to recompile the package with Meteor. You put something like this into package.json:

I've tried but still having the same issues

Thanks for sharing the reproduction.

I'm having trouble installing the repository, perhaps because your NPM packages use a different endpoint.

image

Could you fix this somehow so we can debug further?

EDIT: Removing the package-lock.json fixed it. So I can repro now. I will be back with an ansewer if I find something. I get another error though, but I think is caused by the same.

image


Maybe a workaround is to import the package directly in your HTML using a <script> tag and as an asset. Then, after the script loads, call the attached keplerGl functionality directly from the window object.

<!-- Load Kepler.gl -->
<script src="https://unpkg.com/kepler.gl@3.0.0/umd/keplergl.min.js" crossorigin></script>

@ponytojas
Copy link
Author

Could you provide a concise repository with the necessary code and setup to replicate the issue?

Yes, here it is ponytojas/meteor3-kepler3-test

Another thing you can try is to recompile the package with Meteor. You put something like this into package.json:

I've tried but still having the same issues

Thanks for sharing the reproduction.

I'm having trouble installing the repository, perhaps because your NPM packages use a different endpoint.

Could you fix this somehow so we can debug further?

EDIT: Removing the package-lock.json fixed it. So I can repro now. I will be back with an ansewer if I find something. I get another error though, but I think is caused by the same.

Sorry for the inconvenience with the package-lock, we use a private npm repository as proxy and I think I upload the file with that references.

Yes as you're right is the same error but with another import of the library.

image

Maybe a workaround is to import the package directly in your HTML using a <script> tag and as an asset. Then, after the script loads, call the attached keplerGl functionality directly from the window object.

<!-- Load Kepler.gl -->
<script src="https://unpkg.com/kepler.gl@3.0.0/umd/keplergl.min.js" crossorigin></script>

As workaround could be an option, for now I'm not in that ship as previous version of kepler works with current stable meteor version, this was just a test to adapt our codebase for the next meteor version.

@nachocodoner
Copy link
Member

nachocodoner commented Apr 15, 2024

As workaround could be an option, for now I'm not in that ship as previous version of kepler works with current stable meteor version, this was just a test to adapt our codebase for the next meteor version.

Have you tested the kepler version you use in Meteor 2.x on 3.x?

I understand you tried upgrading kepler to the new 3.x, but testing the previous version in 3.x and failing might mean a regression any on the bundler somehow.

@ponytojas
Copy link
Author

As workaround could be an option, for now I'm not in that ship as previous version of kepler works with current stable meteor version, this was just a test to adapt our codebase for the next meteor version.

Have you tested the kepler version you use in Meteor 2.x on 3.x?

I understand you tried upgrading kepler to the new 3.x, but testing the previous version in 3.x and failing might mean a regression any on the bundler somehow.

Yes, the previous version of kepler is correctly working with Meteor 3.x
So I understand it should be some incompatibility on how they build their newer version and how meteor handle it.

Up to what I'm able to check in their repo and their changelog, they didn't update their babel version (7.X.X) or the build process (apart from move from a solo dependency kepler.gl to multiple dependencies @kepler.gl/XXXXXX).
The only other difference I can see is they've move from JS to TS, but don't thinks is related.

Do you think its some bundle problem with Meteor or should I open an issue in their repo?

@ponytojas
Copy link
Author

Giving some update to keep track of it
I updated the project to 3.0-rc0 and still have the same problem.

@nachocodoner
Copy link
Member

I've got an update.

Successfully ran the project using Meteor, thanks to your provided repo.

The issue isn't with Meteor itself, but rather with the beta version 3 of the kepler library. It has complex dependencies. Your repository lacked some dependencies in package.json.

Referencing the dependencies from the kepler demo app for version 3, I copied them into your project and installed them using meteor npm install --legacy-peer-deps. This fixed the issues.

Here's a screenshot of your app in action.

image

While your app might not need all the dependencies from the example app, some are essential for kepler to work well with the new version. Otherwise, errors like the one described in this git issue may occur. I haven't delved deeper into which ones are necessary, but my aim was to confirm whether Meteor 3's bundler has issues with certain modules, which seems to not be the case.

@ponytojas
Copy link
Author

I've got an update.

Successfully ran the project using Meteor, thanks to your provided repo.

The issue isn't with Meteor itself, but rather with the beta version 3 of the kepler library. It has complex dependencies. Your repository lacked some dependencies in package.json.

Referencing the dependencies from the kepler demo app for version 3, I copied them into your project and installed them using meteor npm install --legacy-peer-deps. This fixed the issues.

Here's a screenshot of your app in action.

While your app might not need all the dependencies from the example app, some are essential for kepler to work well with the new version. Otherwise, errors like the one described in this git issue may occur. I haven't delved deeper into which ones are necessary, but my aim was to confirm whether Meteor 3's bundler has issues with certain modules, which seems to not be the case.

Thanks for the answer @nachocodoner , unfortunately I'm facing the same errors after changing the dependencies with the ones in the demo app from kepler (the same link you shared in your answer)
image

I also noticed in your screenshot that meteor-node-stubs are missing from the package.json, I have to install it before been able to start the meteor app, it could be that your project are resolving dependencies differently than mine?

@nachocodoner
Copy link
Member

nachocodoner commented Apr 30, 2024

I also noticed in your screenshot that meteor-node-stubs are missing from the package.json, I have to install it before been able to start the meteor app

The installation of meteor-node-stubs package is kept on my example, though it was upgraded to 1.2.9 version and not in alphabetical order, which is not an issue, but the reason possibly you didn't see it.

image

it could be that your project are resolving dependencies differently than mine?

Have you tried to re-generate the package-lock.json file?

Did you ensure you use node 20.11.1/ npm 10.2.4 version, and --legacy-peer-deps to avoid warnings/issues on resolving peer deps from kepler deps?

To enforce the node/npm version that you meteor app uses you might use it with meteor prefixed, as meteor npm install --legacy-peer-deps.

You also miss the @babel/runtime package, which is important to proper compilation.

@ponytojas
Copy link
Author

Still not lucky.
I've tried to remove node_modules and package-lock, reinstall every dependency (including babel runtime).
Tried also to remove the whole project and make it new, replace all files with the one in the demo app, uninstall globally meteor and install again the beta.

I don't know what could happens (I also update the demo repo with the changes in the package-lock and src files), but looks is something on my side.

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

4 participants