I'm having an issue using module.exports = {}
in one of my project files.
The file contains many functions which are exported as named exports, but also contains an object spread. It looks something like this:
module.exports = {
...DEFAULT_METHODS,
methodDefinedAbove,
anotherFunction,
moreFunctionsStill,
}
When I import from this file elsewhere in the project. The imports work fine. I can import both statically named functions, like :
import { methodDefinedAbove } from '../../theFileWithExports';
as well as functions that are defined in the DEFAULT_METHODS object, like :
import { definedInDefaultMethods } from '../../theFileWithExports';
This works fine in dozens of files in my project. Today I added a new file and the import does not work. When I remove the ...DEFAULT_METHODS spread, it does work. But I can't figure out why this works in dozens of places and would just break for a new file. The new file is a sibling of other files with working imports.
I can even hack a workaround in by importing the function I want in another file and saving it as a static class variable, then importing that class into the component and using it's static method.