I'm getting mad with module import/export syntax...
Say on a file I want to import a module like this:
import { AccordionMenu } from '../node_modules/lr-js-modules/accordion-menu';
Now, how should I export from accordion-menu? My current code is an old school js class like this:
AccordionMenu = function(options){
[...]
}
AccordionMenu.prototype = { ... }
Then I was exporting like this:
export { AccordionMenu as default };
It doesn't work. Compiler says
export 'AccordionMenu' (imported as 'AccordionMenu') was not found in '../node_modules/lr-js-modules/accordion-menu' (possible exports: default)
I then tried several variants, but none worked to me. From mdn docs, as far as I can tell, all teh variants should work, but it's evident that I'm doing something wrong.
Can you help please?
export { AccordionMenu }?const AccordionMenu = function(options) { ... };then at the end of the fileexport default AccordionMenu;. To import you can thenimport AccordionMenu from '...';- you don't need{ ... }as it's the default export