The short answer is no they're not the same, they have different syntax, but let's be serious.
export const foo = () => {}
...
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.foo = void 0;
var foo = function () { };
exports.foo = foo;
Is what that compiles to using commonjs and es5 as target.
const foo = () => {}
export default { foo }
...
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var foo = function () { };
exports.default = { foo: foo };
Is what that compiles to.
const foo = () => {}
export { foo }
...
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.foo = void 0;
var foo = function () { };
exports.foo = foo;
Is what that compiles to.
Along with that it should also be noted that using:
export { foo }
Can only be imported using:
import {foo} from './foo'
While using:
export default { foo }
Can only be imported using:
import whatever from './foo'
// use whatever.foo
import { foo } from "./mod.js";Your ...fooproperty (which is very different from a named export), which you cannot import using named import syntax. Instead, you'd import the default (import obj from "./foo.js";) and either destructurefoofrom it (const { foo } = obj;) or just use it asobj.foo. That one is not constant; code in modules using it can change the value offoovia simple assignment. The single exported object is shared by all modules.