highcharts / highcharts-vue

Other
686 stars 150 forks source link

vite error always #231

Closed xalteropsx closed 1 year ago

xalteropsx commented 1 year ago

Vite Error, /node_modules/.vite/deps/highcharts-vue.js?v=be3b32d5 optimized info should be defined

xalteropsx commented 1 year ago

Could not resolve "highcharts"

    node_modules/highcharts-vue/dist/highcharts-vue.min.js:1:90:
      1 │ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("highcharts"),require("vue")):"function"==typeof define&&define.amd?define(["highcharts","vue"],e):"object"==typeof exports?expo... 
        ╵                                                                                           ~~~~~~~~~~~~

  You can mark the path "highcharts" as external to exclude it from the bundle, which will remove
  this error. You can also surround this "require" call with a try/catch block to handle this
  failure at run-time instead of bundle-time.
jszuminski commented 1 year ago

Hi, thanks for reporting!

Unfortunately, I've struggled to recreate this issue.

Let me tell you what I did step-by-step:

  1. I've created a Vue project with Vite with npm create vite@latest
  2. I've ran the following commands: npm i npm i highcharts highcharts-vue npm run dev
  3. I've created a simple chart

And everything seems to work correctly. Try to install both highcharts and highcharts-vue packages and everything should work.

If it does not, please try to reproduce this issue so I could take a closer look at how to fix it.

xalteropsx commented 1 year ago

thank u bro that npm i highcharts solved it

xalteropsx commented 1 year ago

thank u very much @jakubSzuminski

jszuminski commented 1 year ago

Sure, no problem.

You can set the chart.backgroundColor: transparent. Here's a demo: https://jsfiddle.net/BlackLabel/p7x8hgma/