My React app is running smoothly with npm start
, but I encounter an error when trying to build it using npm run build
. The error message I receive is:
`Creating an optimized production build...
Failed to compile.
Attempted import error: './parseq-lang.js' does not contain a default export (imported as 'grammar').
The problematic import statement in my code can be found here (view full file):
import grammar from './parseq-lang.js';
The module being imported is generated code from nearleyc
. This is how the export portion of the file looks like (view full file - please note that this is auto-generated code and modifying it directly is not preferred):
(function () {
[...]
if (typeof module !== 'undefined'&& typeof module.exports !== 'undefined') {
module.exports = grammar;
} else {
window.grammar = grammar;
}
})();
If anyone has insights on what could be causing this issue or any tips for debugging, I would greatly appreciate your help! Thank you!