How to import a package that has a score in the name in Vuejs

Asked

Viewed 67 times

0

I need to import a package in Vuejs, whose name is 'Vue-Charts.js', and Vue is accusing error that cannot find the specified file. I tried renaming the package directory but could not. If someone knows how to do this and can help me I appreciate.

import {BarChart} from 'vue-chart.js'

Error:

Cannot resolve file 'vue-chart.js' less
Reports unresolved file references in JavaScript files, including CommonJS and 
AMD modules references
  • is a dependency? installed with npm install?

  • Have you tried using full path or taking out . js?

  • installed using npm install, and I’ve tried several things, but I was able to find a lib similar sound the point in the name, thank you guys

  • That one vue-chart.js is in the same directory as the file that imports it?

  • The vue-chart.js is in the node_modules folder, while I import it in the src/Components folder of Vue, in one of the components that I will use it.

1 answer

0


Hello This import you’re trying is a module of yours? or is it from some package installed in node_modules, if you enter the package url, even to test. if it’s your choice

import {BarChart} from './vue-chart'

  • It’s a node_modules package, and this is the link: https://www.npmjs.com/package/vue-chart.js. Thank you for taking a look at it...

  • Opa, blz cara achei o problema, esta certo assim import {Barchart} from 'Vue-Chart.js' , porem esse plugin é da Vue 1 e talvez você está usando a Vue 2

  • Good! What’s the problem??

  • I found really cool the plugin I’m thinking of writing it for Vue 2, I’ll take this week a time to do this, then I share it with you

  • Okay, I stand by, thank you very much @Heber Almeida

  • opa, I did a search found similar packages, see if help, https://github.com/apertureless/vue-chartjs and this https://github.com/hchstera/vue-charts both are with Vue 2

  • Already help yes, I just need to now make it work on Quasar. Thank you again Heber

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.