TypeError: Cannot read properties of undefined (reading 'buttons')
TypeError: Cannot read properties of undefined (reading 'buttons')
cmplus
Posts: 65Questions: 13Answers: 0
in DataTables
I chose the npm installation, I run the commands and after I insert the list in vite.config.js I receive this error
npm install --save jquery
npm install --save jszip
npm install --save pdfmake
npm install --save datatables.net-bs5
npm install --save @datatables.net/editor-bs5
npm install --save datatables.net-autofill-bs5
npm install --save datatables.net-buttons-bs5
npm install --save datatables.net-colreorder-bs5
npm install --save datatables.net-datetime
npm install --save datatables.net-fixedcolumns-bs5
npm install --save datatables.net-fixedheader-bs5
npm install --save datatables.net-keytable-bs5
npm install --save datatables.net-responsive-bs5
npm install --save datatables.net-rowgroup-bs5
npm install --save datatables.net-rowreorder-bs5
npm install --save datatables.net-scroller-bs5
npm install --save datatables.net-searchbuilder-bs5
npm install --save datatables.net-searchpanes-bs5
npm install --save datatables.net-select-bs5
npm install --save datatables.net-staterestore-bs5
error during build:
TypeError: Cannot read properties of undefined (reading 'buttons')
at file:///home/......../node_modules/datatables.net-buttons/js/buttons.colVis.mjs:14:24
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
at async loadConfigFromBundledFile (file:///home/......../node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:66691:15)
at async loadConfigFromFile (file:///home/......../node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:66532:24)
at async resolveConfig (file:///home/......../node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:66140:24)
at async build (file:///home/......../node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:65237:18)
at async CAC.<anonymous> (file:///home/......../node_modules/vite/dist/node/cli.js:828:5)
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import jQuery from "jquery";
import jszip from 'jszip';
import pdfmake from 'pdfmake';
import DataTable from 'datatables.net-bs5';
import Editor from '@datatables.net/editor-bs5';
import 'datatables.net-autofill-bs5';
import 'datatables.net-buttons-bs5';
import 'datatables.net-buttons/js/buttons.colVis.mjs';
import 'datatables.net-buttons/js/buttons.html5.mjs';
import 'datatables.net-buttons/js/buttons.print.mjs';
import 'datatables.net-colreorder-bs5';
import DateTime from 'datatables.net-datetime';
import 'datatables.net-fixedcolumns-bs5';
import 'datatables.net-fixedheader-bs5';
import 'datatables.net-keytable-bs5';
import 'datatables.net-responsive-bs5';
import 'datatables.net-rowgroup-bs5';
import 'datatables.net-rowreorder-bs5';
import 'datatables.net-scroller-bs5';
import 'datatables.net-searchbuilder-bs5';
import 'datatables.net-searchpanes-bs5';
import 'datatables.net-select-bs5';
import 'datatables.net-staterestore-bs5';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/sass/app.scss',
'resources/js/app.js',
],
refresh: true,
}),
],
resolve: {
alias: {
'$': 'jQuery'
},
},
});
Replies
Here is a running example of Vite, Vue, Bootstrap 5, DataTables and the export buttons.
Allan