Top "Commonjs" questions

CommonJS is a project whose goal is to move JavaScript outside the browser.

Can I use alias with NodeJS require function?

I have an ES6 module that exports two constants: export const foo = "foo"; export const bar = "bar"; I can do …

javascript node.js ecmascript-6 commonjs
typescript node.js express routes separated files best practices

using Express in a Node project along with Typescript what would be the "best practices" for express.Router. example directory …

node.js express module typescript commonjs
What is CommonJS and why should I care how it can help in writing .js applications?

I'm learning JS and someone more experienced mentioned that they use CommonJS to handle keeping js code organized (since there's …

javascript commonjs
Node.js ES6 how to export class from module?

I'm trying to export an ES6 class from a CommonJS module in Node.js 6.2.0 class MyClass{ //class contents here } exports = …

javascript node.js ecmascript-6 commonjs
How to import part of object in ES6 modules

In the react documentation I found this way to import PureRenderMixin var PureRenderMixin = require('react/addons').addons.PureRenderMixin; How can …

javascript module browserify ecmascript-6 commonjs
"Error: Cannot find module 'less'" Node.js module loading preference/order/cache?

Here's the situation… So I've created a Node.js module that acts as an interface to some Node.js template …

node.js module require commonjs
NodeJS modules vs classes

To me classes are quite similar to NodeJS (CommonJS) modules. You can have many of them, they can be reused, …

class node.js module commonjs
Class constructor cannot be invoked without 'new' - typescript with commonjs

I am making server side chat with colyseus (node game server framework). Im using typescript with module:commonjs because colyseus …

node.js typescript commonjs
How to "require" text files with browserify?

I am using browserify (using browserify-middleware) how can I require simple text files, something like: var myTmpl = require("myTmpl.txt"); …

node.js backbone.js commonjs browserify
Generating source maps from browserify using grunt

I have followed the instructions here: https://www.npmjs.org/package/grunt-browserify, to try and set up source maps for …

javascript gruntjs browserify commonjs