Import/Export errors relating to modules
Hello,
I'm currently testing version 3.3.0-beta2 of this library out with the latest versions of webpack and babel. When attempting to get the example to work on your main README, I receive numerous import / export errors that I believe I've pinpointed down to the use of modules and not using file extensions in your dist import and export statements.
The first handful of errors look like this:
Compiled with problems:
ERROR in ./app/javascript/bundles/components/DocumentType/DocumentTypesContainer.jsx 51:14-31
export 'GridCellKind' (imported as 'GridCellKind') was not found in '@glideapps/glide-data-grid' (possible exports: default)
ERROR in ./app/javascript/bundles/components/DocumentType/DocumentTypesContainer.jsx 58:14-31
export 'GridCellKind' (imported as 'GridCellKind') was not found in '@glideapps/glide-data-grid' (possible exports: default)
ERROR in ./app/javascript/bundles/components/DocumentType/DocumentTypesContainer.jsx 71:42-61
export 'DataEditorContainer' (imported as 'DataEditorContainer') was not found in '@glideapps/glide-data-grid' (possible exports: default)
ERROR in ./node_modules/@glideapps/glide-data-grid/dist/js/index.js 1:0-55
Module not found: Error: Can't resolve './data-editor/data-editor' in '/Users/XXX/XXX/XXXX/XXXXX/node_modules/@glideapps/glide-data-grid/dist/js'
Did you mean 'data-editor.js'?
BREAKING CHANGE: The request './data-editor/data-editor' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
... More errors like this...
I've confirmed that manually adding the .js to all the exports in node_modules/@glideapps/glide-data-grid/dist/js/index.js appears to solve these errors, but then reveals a whole new set of similar errors for other files in this library.
I haven't come across this before, but it appears that just being explicit about the file extension is sufficient to fix this.
Would you consider adding extensions to your import/export statements? Or do you have an alternate suggestion?
Thanks!
This should go away if you disable fullySpecified in your webpack config. I will look into seeing if its possible to have the extensions added by our build process.
Thanks @jassmith - appreciate the response.