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

'Vue2' is not exported #51

Closed
mathieutu opened this issue Mar 22, 2021 · 5 comments
Closed

'Vue2' is not exported #51

mathieutu opened this issue Mar 22, 2021 · 5 comments

Comments

@mathieutu
Copy link

mathieutu commented Mar 22, 2021

Hi,
This issue because I've a problem trying to build our project on heroku:
error during build:

       $ vite build

       vite v2.1.2 building for production...

       transforming...

       ✓ 2085 modules transformed.

'Vue2' is not exported by ../../node_modules/vue-demi/lib/index.esm.js, imported by ../../node_modules/vue-echarts/dist/index.esm.min.js

file: /tmp/build_8432c290/node_modules/vue-echarts/dist/index.esm.min.js:1:180

1: import{watch as e,inject as t,computed as n,unref as o,watchEffect as i,defineComponent as r,ref as a,shallowRef as u,toRefs as c,toRef as s,onMounted as l,onUnmounted as p,h as f,Vue2 as v,nextTick as d}from"vue-demi";import{throttle as h,init as g}from"echarts/core";import{addListener as O,removeListener as m}from"resize-detector";var y=function(){return(y=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},b=["getWidth","getHeight","getDom","getOption","resize","dispatchAction","convertToPixel","convertFromPixel","containPixel","getDataURL","getConnectedDataURL","appendData","clear","isDisposed","dispose"];var j={autoresize:Boolean},x="ecLoadingOptions";var L={loading:Boolean,loadingOptions:Object};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("x-vue-echarts{display:block;width:100%;height:100%}");var C=/^on[^a-z]/,U=function(e){return C.test(e)};v&&v.config.ignoredElements.push("x-vue-echarts");var z="ecTheme",D="ecInitOptions",E="ecUpdateOptions",w=r({name:"echarts",props:y(y({option:Object,theme:{type:[Object,String]},initOptions:Object,updateOptions:Object,group:String,manualUpdate:Boolean},j),L),inheritAttrs:!1,setup:function(r,f){var v=f.attrs,j=f.listeners,x=a(),L=u(),C=u(),z=t("ecTheme",null),D=t("ecInitOptions",null),E=t("ecUpdateOptions",null),w=n((function(){return C.value||r.option||Object.create(null)})),A=n((function(){return r.theme||o(z)||{}})),T=n((function(){return r.initOptions||o(D)||{}})),R=n((function(){return r.updateOptions||o(E)||{}})),B=c(r),P=B.autoresize,S=B.manualUpdate,k=B.loading,H=s(r,"theme"),I=s(r,"initOptions"),N=s(r,"loadingOptions"),W=n((function(){return function(e){var t={};for(var n in e)U(n)||(t[n]=e[n]);return t}(v)}));function F(e){if(!L.value&&x.value){var t=L.value=g(x.value,A.value,T.value);r.group&&(t.group=r.group);var n=j;n||(n={},Object.keys(v).filter((function(e){return 0===e.indexOf("on")&&e.length>2})).forEach((function(e){var t=e.charAt(2).toLowerCase()+e.slice(3);n[t]=v[e]}))),Object.keys(n).forEach((function(e){var o=n[e];o&&(0===e.indexOf("zr:")?t.getZr().on(e.slice(3).toLowerCase(),o):t.on(e.toLowerCase(),o))})),t.setOption(e||w.value,R.value),d(o),setTimeout(o)}function o(){t&&!t.isDisposed()&&t.resize()}}function Z(){L.value&&(L.value.dispose(),L.value=void 0)}var q=null;e(S,(function(t){"function"==typeof q&&(q(),q=null),t||(q=e((function(){return r.option}),(function(e){e&&(L.value?L.value.setOption(e,r.updateOptions):F())}),{deep:!0}))}),{immediate:!0}),e([H,I],(function(){Z(),F()}),{deep:!0}),i((function(){r.group&&L.value&&(L.value.group=r.group)}));var G=function(e,t){function n(n){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(e.value||t(),!e.value)throw new Error("ECharts is not initialized yet.");return e.value[n].apply(e.value,o)}}function o(e){return n(e)}return y(y({},(i=Object.create(null),b.forEach((function(e){i[e]=n(e)})),i)),{dispatchAction:o("dispatchAction"),getDataURL:o("getDataURL"),getConnectedDataURL:o("getConnectedDataURL")});var i}(L,F);!function(e,r,a){var u=t("ecLoadingOptions",{}),c=n((function(){return y(y({},o(u)),null==a?void 0:a.value)}));i((function(){var t=e.value;t&&(r.value?t.showLoading(c.value):t.hideLoading())}))}(L,k,N),function(t,n,o,i){var r=null,a=0;function u(){var e=o.value;return e?e.offsetWidth*e.offsetHeight:0}e([o,t,n],(function(e,t,n){var o=e[0],c=e[1],s=e[2];o&&c&&s&&(a=u(),r=h((function(){0===a?(c.setOption(Object.create(null),!0),c.resize(),c.setOption(i.value,!0)):c.resize(),a=u()}),100),O(o,r)),n((function(){r&&o&&(a=0,m(o,r))}))}))}(L,P,x,w),l((function(){r.option&&F()})),p(Z);var J=y({root:x,setOption:function(e,t){r.manualUpdate&&(C.value=e),L.value?L.value.setOption(e,y(y({},R.value),t)):F(e)},nonEventAttrs:W},G);return Object.defineProperty(J,"chart",{get:function(){return o(L)}}),J},render:function(){var e=y({},this.nonEventAttrs);return e.ref="root",e.class=e.class?["echarts"].concat(e.class):"echarts",f("x-vue-echarts",e)}});export default w;export{D as INIT_OPTIONS_KEY,x as LOADING_OPTIONS_KEY,z as THEME_KEY,E as UPDATE_OPTIONS_KEY};

                                                                                                                                                                                       ^

2: //# sourceMappingURL=index.esm.min.js.map

error during build:

Error: 'Vue2' is not exported by ../../node_modules/vue-demi/lib/index.esm.js, imported by ../../node_modules/vue-echarts/dist/index.esm.min.js

    at error (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:5307:30)

    at Module.error (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:9716:16)

    at Module.traceVariable (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:10104:29)

    at ModuleScope.findVariable (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:8874:39)

    at Identifier.bind (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:4042:40)

    at LogicalExpression.bind (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:2744:23)

    at LogicalExpression.bind (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:7824:15)

    at ExpressionStatement.bind (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:2744:23)

    at Program.bind (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:2740:31)

    at Module.bindReferences (/tmp/build_8432c290/node_modules/rollup/dist/shared/rollup.js:9712:18)

error Command failed with exit code 1.

       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error Command failed.

Exit code: 1

I actually don't understand why we have this, as the build is ok in local... 🤔
We use vue-3 and vitejs.

Any ideas?

Thanks.

Issue cross-posted in vue-echarts

@mathieutu
Copy link
Author

I've added node node_modules/vue-demi/bin/vue-demi-fix.js in a postinstall script, but I don't see why it don't work out of the box. (and I see that you have a default file which should match vue3, but it is not updated with last developments)

@antfu
Copy link
Member

antfu commented Mar 22, 2021

I've added node node_modules/vue-demi/bin/vue-demi-fix.js in a postinstall script, but I don't see why it don't work out of the box. (and I see that you have a default file which should match vue3, but it is not updated with last developments)

Does this work? If so, I'd think it might not be the problem of vue-demi itself. As all we can do is to have the "script.postinstall" field. Maybe you need to check the reason why the post-install script does not get triggered.

@mathieutu
Copy link
Author

Yeah it works, and I have no idea why the postinstall could not be triggered. 🤷
But maybe could we add the last devs in the root files (as they are outdated)?

@antfu
Copy link
Member

antfu commented Mar 22, 2021

Oh yeah, I got your point! Fixing now

@antfu antfu closed this as completed in ab2a165 Mar 22, 2021
@mathieutu
Copy link
Author

Thanks! 👍

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

2 participants