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

Issue when trying to run esbuild bundle #7380

Closed
LukaszPiatkowski27 opened this issue Jul 1, 2024 · 11 comments · Fixed by #7426
Closed

Issue when trying to run esbuild bundle #7380

LukaszPiatkowski27 opened this issue Jul 1, 2024 · 11 comments · Fixed by #7426
Assignees
Labels
Bug Issues which are marked as Bug confirmed Issues that have been confirmed with a reduced test case and identify a bug. has PR Issues that has been fixed with a PR.

Comments

@LukaszPiatkowski27
Copy link

Bootstraptable version(s) affected

1.23.0

Description

trying to run this command
esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets
throws the following error:
image

Using version 1.22.6 there is no issue

Example(s)

No response

Possible Solutions

No response

Additional Context

No response

@LukaszPiatkowski27 LukaszPiatkowski27 added the Bug Issues which are marked as Bug label Jul 1, 2024
@UtechtDustin
Copy link
Collaborator

I never heard of esbuild, but it seems it's an bundler like webpack etc. ?
I'm not sure if we can help with that issue.
@wenzhixin do you used it before ?

@LukaszPiatkowski27 i guess you already tried to find a solution on google or in the esbuild community ?
The chance is high, that this is an issue of esbuild as other bundler works fine.

@UtechtDustin UtechtDustin added the awaiting reply Issues that are awaiting reply, will be closed if there is no any response in 7 days. label Jul 1, 2024
@jnimety
Copy link

jnimety commented Jul 3, 2024

FWIW esbuild is at least used by vite, and other bundlers if I recall correctly.

That said, it looks like boostrap-table is missing a dependency on core-js. My copy of node_modules/bootstrap-table/dist/bootstrap-table.js has many references to core-js and I don't see core-js in node_modules/bootstrap-table/package.json. I too was getting "Could not resolve" errors when building with vite/esbuild and adding core-js to my package.json fixed the errors.

@HealthyPizza
Copy link

Similar issue with symfony asset:mapper, and another project with yarn.

No issue when locking at 1.22.6

image

@LukaszPiatkowski27
Copy link
Author

LukaszPiatkowski27 commented Jul 4, 2024

@UtechtDustin Yes, It's a bundler, webpack alternative.
I did search for a solution, but didn't find anything (ofc adding core-js manually works, but that's just not a solution in my case).
You can see that the core-js dependency is missing for more people.

@UtechtDustin
Copy link
Collaborator

Oh okay, thanks for the informations!
I guess i found the issue, as we use babel-preset-env which then uses polyfills using core-js.

The Problem is i can't submit a PR for that, as the bootstrap-table currently uses yarn as dependency manager and i stopped using yarn 2 years ago and switched back to npm. As i don't see huge advantages to use yarn instead of npm right now. We just add a layer on top (also the installation and version management is quit shit - in my opinion - on the newest yarn version).
@wenzhixin What is the reason, that we use yarn instead of npm ? Could we switch to npm ?

@UtechtDustin UtechtDustin added confirmed Issues that have been confirmed with a reduced test case and identify a bug. and removed awaiting reply Issues that are awaiting reply, will be closed if there is no any response in 7 days. labels Jul 7, 2024
@jnimety
Copy link

jnimety commented Jul 17, 2024

Any update on this? IMHO a separate issue should be opened to discuss package manager preferences and in the meantime the proper dependencies can be added using yarn.

@wenzhixin
Copy link
Owner

wenzhixin commented Jul 20, 2024

@wenzhixin do you used it before?

I have not used esbuild before, either.

However, I followed the following steps to test it:

Create a file main.js

import 'bootstrap-table'

I think you can solve your problem using the following method, and I will also investigate whether there is a better way.

You can add core-js and jquery in your package.json to solve the problem.

npx esbuild src/main.js --bundle --sourcemap --outdir=builds

  builds/main.js      548.8kb
  builds/main.js.map  910.6kb

⚡ Done in 65ms

@UtechtDustin
Copy link
Collaborator

@wenzhixin
We just have to add core-js as dependency to our package.json and the issue should be fixed.
As i mentioned above i can't submit a PR as we still using yarn and not npm, is there a reason for that ?

@wenzhixin
Copy link
Owner

My idea is to improve the build script without dependency on core-js.

@wenzhixin
Copy link
Owner

Adding core-js to devDependencies can solve the problem, and the built files in dist will not require core-js at all.

@wenzhixin wenzhixin added the has PR Issues that has been fixed with a PR. label Jul 26, 2024
@wenzhixin
Copy link
Owner

What is the reason we use yarn instead of npm? Could we switch to npm?

I'm sorry, @UtechtDustin, for the oversight. I forgot to respond to you on this matter. I switched to using yarn a few years ago after encountering some issues with npm and have been using it ever since. This includes my work environment and open-source projects, where I consistently use yarn.

As far as I understand, using yarn or npm for different projects should be possible. You can install yarn by running npm i -g yarn. Whether there is a need to switch back to npm should be evaluated. However, I think yarn should not affect its current usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues which are marked as Bug confirmed Issues that have been confirmed with a reduced test case and identify a bug. has PR Issues that has been fixed with a PR.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants