Cannot build evaluation version of Editor with Vite/Vue
Cannot build evaluation version of Editor with Vite/Vue
I'm using evaluation version of Editor in Vite/Vue framework and I've installed necessary packages.
Application does not build when I try to import and use Editor.
The problem is in node_modules\@datatables.net\editor-2023-05-27-dt\js\editor.dataTables.mjs:
/*! DataTables styling integration for DataTables' Editor
* ©SpryMedia Ltd - datatables.net/license
*/
import $ from 'jquery'
import DataTable from 'datatables.net-dt'
import Editor from '@datatables.net/editor-2023-05-27'
var Editor = DataTable.Editor
export default Editor
First issue is with
Identifier 'Editor' has already been declared (Note that you need plugins to import files that are not JavaScript)
file: C:/vue/ws2022/node_modules/@datatables.net/editor-2023-05-27-dt/js/editor.dataTables.mjs:9:4
I applied correction to DataTable.Editor = Editor as proposed by kshinde in https://datatables.net/forums/discussion/comment/220864/#Comment_220864.
However after this the build aborts with
Illegal reassignment to import '$'
file: C:/vue/ws2022/node_modules/@datatables.net/editor-2023-05-27/js/dataTables.editor.mjs:20:104206
Is this problem related only to evaluation version and can you fix it or propose solution?
Best regards, Janez
Answers
Hi Janez,
Yes, you can't do:
In Javascript. The would be declaring
X
twice (Editor
in your sample code above).You shouldn't actually need line 9 - I think you can just drop that.
I think I've made an identical error in the 2.1.2 release of Editor which is causing that
Illegal reassignment
error. I'll tag up and release 2.1.3 with a fix for that tomorrow. Apologies for the error.Regards,
Allan
I'm also seeing the error "Identifier 'Editor' has already been declared". Removing the declaration :var Editor = DataTable.Editor; in
node_modules/@datatables.net/editor-dt/js/editor.dataTables.mjs
eliminates the error. But your comment above suggests that I should have picked yp the fix in 2.1.3, which is the version that I have installed. Can you clarify?
Darn it - sorry! I had a fix in the core Editor file, but not in the styling integration file which also contains an error.
You can delete that line in the
editor.dataTables.mjs
file for the moment as a workaround. I'll get this patched and pushed out soon.Allan
Thanks for your help on this. Will look for a new version.