[Vuejs]-Cannot access variable from named imports in vuejs

0πŸ‘

βœ…

It seems like using an imported object does not allow for named imports later.

So even though lib is an object with keys for Graphs it does not work after importing it like that.

So what I had to do was export those again as named exports.

so index.js became:

import lib from './components/index'
export let Graphs = lib.Graphs
export default lib

0πŸ‘

in your index file you will get result

// import lib from "components/index.js";
//  given result lib.Graphs, lib.Tabs
//  then you exporting object like { lib: { Graphs: '....', Tabs: '...' } }
export default { lib }; 

because have this result.
in this situation index.js action is unnecessary

Leave a comment