GoogleWebComponents / google-chart

Google Charts API web components
https://www.webcomponents.org/element/@google-web-components/google-chart/elements/google-chart
Apache License 2.0
357 stars 130 forks source link

Can't import the library in Vuejs #285

Closed koladev32 closed 4 years ago

koladev32 commented 4 years ago

Hi. I am trying to use the library with Vuejs but I don't know how import it well. Here's the line of code I used but it didn't worked at all. import google from "@google-web-components/google-chart";

rslawik commented 4 years ago

Hi, what error are you seeing?

There is no export called google, so the import should be:

import "@google-web-components/google-chart";

The path also needs to be rewritten to a real node_modules path for the browser to accept it. This typically is done automatically by tools like TypeScript, bundlers or es-dev-server. If you don't use any of those tools, the path will look like this (depending on the location of your file):

import "../node_modules/google-chart/google-chart.js";
koladev32 commented 4 years ago

Okay thanks 🙏🏿

rslawik commented 4 years ago

Cool, I assume it worked. Please reopen if it didn't.