How To Use Import & Export In Node.js?
I have two files : app.js module.js app.js will have expression, import 'foo' from './module' //use foo.. and module.js will have, export default {expression} But it is not wor
Solution 1:
Your import does not need the quotes, or braces if importing a default export:
import foo from'./module';
Also your export should look something like:
exportdefault expression;
and if the exported item is called expression you'd import it as:
import expression from'./module';
(you need the braces when importing non-default exports).
Very good in-depth explanation here:
Post a Comment for "How To Use Import & Export In Node.js?"