question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Vue2' is not exported

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mathieutucommented, 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)

0reactions
mathieutucommented, Mar 22, 2021

Thanks! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Vue2' is not exported · Issue #51 · vueuse/vue-demi - GitHub
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...
Read more >
Vue.js Error export was not found when using import { }
There are two kinds of exports in es6 modules: named and default. When you see the braces { } in an import, that's...
Read more >
does not provide an export named 'vue' - You.com - You.com
The thing you want to do is import vue but it doesnot have a default export function or either the default thing to...
Read more >
Javascript - Export default was not found - Laracasts
I have a project build in Vue 2, and I made a simple function for ... but I get an error: "export 'default'...
Read more >
WARN export 'default' (imported as 'Vue') was not found in 'vue'
Now after doing some research , I got to know that in Vue v3, Vue is not getting exported by default, instead now...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found