Closed kaashok closed 8 months ago
I'm afraid I cant replicate your issue, it works fine when I try it.
I'm afraid for security reasons I won't download zip files from here.
It would suggest there is something with your import as the undefined is showing that the module class is not importing
I have created a Github repo with my code, Please clone it and check the import issue.
Github Repo: Repo
@kaashok Im afraid im not sure what to tell you there, it seems like there must be an issue with your build setup.
It works fine for me, and given this is the primary method of importing Tabulator into most peoples projects, if there was a break on the import functionality i would expect 100's of issue tickets to appear on this subject, or at the very least a great many comments or votes on the issue here, which just hasn't happened.
While i understand this is not the answer you were hoping for, Im afraid i cant offer a personal debugging services for peoples environments. You could try messaging on the discord server and see if anyone has any advice for you there.
Cheers
Oli :)
@olifolkerd I've also just hit this trying to build Beekeeper using esbuild.
@rathboma do you have an example of which classes you are importing that are causing the error?
Cheers
Oli :)
Hey! We figured out the error. When using esbuild
with a node
target for an electron process it imports the wrong version of tabulator (or treats it wrong in some way)..
Here's an esbuild plugin we wrote to fix it:
const tabulatorPlugin = {
name: 'tabulator-tables resolver',
setup(build) {
build.onResolve({ filter: /^tabulator-tables$/ }, async (args) => {
const result = await build.resolve('../../node_modules/tabulator-tables/dist/js/tabulator_esm.js', {
kind: 'import-statement',
resolveDir: path.dirname(args.path),
})
if (result.errors.length > 0) {
return { errors: result.errors }
}
return {
path: result.path
}
});
},
}
@olifolkerd As @rathboma mentioned, there is definitely a problem with importing the module into an electron node app, as of 6.2.2. The import return value of TabulatorFull
is undefined.
import { TabulatorFull } from 'tabulator-tables';
Describe the bug When extend the module to build own module, I am getting error "Class extends value undefined is not a constructor or null"
Tabulator Info
Working Example typescript-project-tabulator.zip I have created a simple typescript project using AMD Module (as per my project settings) and attached. To setup the project run following commands
npm i
npm run build
open the
index.html
file from dist folder to view output.To Reproduce A step by step guide to recreate the issue in your code:
index.html
file from dist folder to view outputExpected behavior Build a own modules in my project enviroment.
Screenshots
Desktop (please complete the following information):
Additional context I have already create an issue regrading this, but the solution suggested by @olifolkerd is not working old issue URL: https://github.com/olifolkerd/tabulator/issues/4379