TypeScript Exports Module for Node.js | ATLASSC.NET
Skip to main content
/// .DATA.FRAGMENT_20220902

TypeScript Exports Module for Node.js

1 minAuthor: Z.SHINCHVEN

Long Story Short

const func = () => {
    console.log('Hello World');
}

// Export for TypeScript module system
export default func;

// Export for Node.js module system, by doing this you can use `require` to import the module in Node.js 
if (typeof module !== 'undefined') {
    module.exports = Object.assign(func, module.exports)
}
RackNerd Billboard Banner
Share node:
/// .RELATED.DATA_STREAMSShared tags

Related posts

Scanning_database_for_correlations…

/// .UPLINK.SUBSCRIBE

Keep your deck synced with every new transmission from ATLASSC.NET. Subscribe over RSS or Atom, or wire the whole archive straight into your AI assistant with the MCP server.