KenkouGmbH / vue-stripe-elements

A Vue wrapper for stripe elements
9 stars 1 forks source link

core-js compatibility issue with vue-cli@4 #3

Open seangwright opened 5 years ago

seangwright commented 5 years ago

Hello,

I've upgrade my project to use v4 of the Vue CLI, which requires a newer version of core-js.

I'm using the following versions:

"core-js": "3.3.3",
"@vue/cli-service": "4.0.5",

When I load the app in the browser, I see the following error.

_is-object.js:1 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
    at Module.<anonymous> (_is-object.js:1)
    at Module../node_modules/@kenkou/vue-stripe-elements/node_modules/core-js/modules/_is-object.js (chunk-vendors.js:38698)
    at __webpack_require__ (bootstrap:79)
    at Object../node_modules/@kenkou/vue-stripe-elements/node_modules/core-js/modules/_an-object.js (_an-object.js:1)
    at __webpack_require__ (bootstrap:79)
    at Module../node_modules/@kenkou/vue-stripe-elements/node_modules/core-js/modules/_object-dp.js (_object-dp.js:1)
    at __webpack_require__ (bootstrap:79)
    at Object../node_modules/@kenkou/vue-stripe-elements/node_modules/core-js/modules/_hide.js (_hide.js:1)
    at __webpack_require__ (bootstrap:79)
    at Object../node_modules/@kenkou/vue-stripe-elements/node_modules/core-js/modules/_export.js (_export.js:3)

I imagine it's because the version of core-js this project depends on is 2.x, and there are breaking changes between it and 3.x.

See Vue CLI 4 migration : https://cli.vuejs.org/migrating-from-v3/#core-js

The issue I'm seeing appears here was well https://github.com/vuejs/vue-cli/issues/1568#issuecomment-401600992

Since I have to support IE11, I'm finding I have to leave this library out of transpileDependencies in the vue.config.js and instead import directly from @kenkou/vue-stripe-elements/dist/lib.common.js for all components.

It must be either Webpack or Vue CLI that is assuming my project wants to pull from your package.json/module property instead of package.json/main.

Thoughts?

rcarcasses commented 5 years ago

Hi @seangwright, sorry for the late reply. I think you made a great research, honestly I'm not sure how can we help you to go around this issue. Anyway I'll take a second glance to this later, in the mean time if you come up with a solution please do not hesitate to open a pull request to this. Thanks!