teambit / bit.envs

DEPRECATED - Bit compilers and testers were moved to https://github.com/teambit/envs
https://bit.dev/bit/envs
Other
23 stars 9 forks source link

Vue bundler need babel-runtime when consume the component #56

Closed JoshK2 closed 4 years ago

JoshK2 commented 4 years ago

I exported this component https://bit.dev/joshk/epic-spinners-final-1/radar-spinner from this project https://github.com/epicmaxco/epic-spinners/tree/v1.1.0 and when I use it in a new vue project, I get this error:

This dependency was not found:

* babel-runtime/core-js/object/assign in ./node_modules/@bit/joshk.epic-spinners-final-1.radar-spinner/dist/main.js

To install it, you can run: npm install --save babel-runtime/core-js/object/assign

After I install babel-runtime everything is working. If I use the radar-spinner from the epic-spinners library I don't get this error.

The problem is that Object.assign function is replaced by require("babel-runtime/core-js/object/assign"). So I think is a problem with the webpack config. I use this bundler https://bit.dev/bit/envs/bundlers/vue/~code?version=2.5.1

GiladShoham commented 4 years ago

That should be resolved by:

  1. Bit to support get a regular dependency from the compiler (curretnly it supports only dev deps).
  2. Vue compiler to utilize it and add the babel-runtime.

It can be worked around for now by:

  1. add the babel runtime dep via overrides feature. Or
  2. trying to change the compiler config to not use babel run time. It usually some webpack configuration.

In general, it's not a good idea to have babel runtime in bit components.

JoshK2 commented 4 years ago

I added the babel-runtime as dependencies and it's working https://bit.dev/epicmax/epic-spinners/radar-spinner