Summer Sale! All accounts are 50% off this week.

benji's avatar
Level 6

VueChartsCSS & Vite - Uncaught (in promise) TypeError: Cannot read properties of null (reading 'isCE')

Hello all,

I'm working on a fresh Laravel/Jetstream/Vue3/TailwindCSS install and attempting to figure out how to import a dependency for VueChartCSS which is a wrapper for Chart.css. I like the functionality of being able to use standard Chartcss for blade files and then hopefully use VueChartCSS for Vue components.

  • composer create-project laravel/laravel chartcss
  • cd chartcss
  • composer require laravel/jetstream
  • php artisan jetstream:install inertia --teams --pest
  • npm install
  • npm run build
  • php artisan migrate
  • npm run dev
  • php artisan serve
  • npm install charts.css
  • npm install vue.charts.css

I'm following the basic setup instructions from - https://vue-charts-css.github.io/docs/get-started/usage/

/app.js

import './bootstrap';
import '../css/app.css';
import 'charts.css';

import { createApp, h } from 'vue';
import VueChartsCSS from "vue.charts.css"
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m';

const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
    setup({ el, app, props, plugin }) {
        return createApp({ render: () => h(app, props) })
            .use(plugin)
            .use(ZiggyVue, Ziggy)
            .use(VueChartsCSS)
            .mount(el);
    },
});

InertiaProgress.init({ color: '#4B5563' });

and I've dropped the basic chart example here app/resources/js/components/welcome.vue

<template>
    <charts-css
        heading="Coffee count"
        type="bar"
        :labels="['Mon', 'Tue', 'Wed',]"
        :datasets="[ { values: [4, 2, 70,] } ]"
    />
</template>

I get the following error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'isCE') at lt (vue-charts-css.min.js:1:17459)

[Vue warn]: Unhandled error during execution of render function at <ChartsCss heading="Coffee count" type="bar" labels= (3) ['Mon', 'Tue', 'Wed'] ... >

I think what's happening is the VueChartCSS wrapper is working based on some trial and error. But the whole thing isn't rendering properly because I'm not importing the Chart CSS dependency and making it available to Vue.

I've tried various ways to import the chartcss package but all attempts have confused me more. I don't fully understand how these asset compilers work yet.

Thank you for your support.

Ben

0 likes
2 replies
benji's avatar
Level 6

Update: I've been looking into the error some more. I've found this thread which is leading me to believe this is a clash between duplicate Vue packages - https://github.com/vuejs/core/issues/4344

I've been trialling some of the solutions found in the thread but nothing quite works for the vite.config.js file just yet.

lalosalamanca's avatar

Thanks for providing the full setup and error details. This looks more like a Vue 3 compatibility issue than a Chart.css import problem. I'd recommend checking that vue.charts.css supports your current versions of Vue, Vite, and Inertia, as the isCE error is often caused by version mismatches or plugins built for an older Vue release. I have found a platform that might help in it!

Please or to participate in this conversation.