Hi,
I am trying sage 10 for the first time and all going well, however; Trying to add apexcharts.js is causing issue, I have confirmed the node module is installed and package.json lists apexcharts as a dependency.
This is my app.js, alpinejs is working as expected but apexcharts results in
Uncaught ReferenceError: ApexCharts is not defined
import { domReady } from '@roots/sage/client'
import Alpine from 'alpinejs'
import ApexCharts from 'apexcharts'
/**
* app.main
*/
async function main(err) {
if (err) {
// handle hmr errors
console.error(err);
}
// application code
document.addEventListener('DOMContentLoaded', function () {
var replacers = document.querySelectorAll('[data-replace]');
for (var i = 0; i < replacers.length; i++) {
let replaceClasses = JSON.parse(
replacers[i].dataset.replace.replace(/'/g, '"')
);
Object.keys(replaceClasses).forEach(function (key) {
replacers[i].classList.remove(key);
replacers[i].classList.add(replaceClasses[key]);
});
}
});
}
/**
* Initialize
*
* @see https://webpack.js.org/api/hot-module-replacement
*/
domReady(main)
import.meta.webpackHot?.accept(main)
window.Alpine = Alpine
window.ApexCharts = ApexCharts
Alpine.start()
Any guidance appreciated