Modules vs. Namespaces: What is the correct way to organize a large typescript project?

tl;dr: Do not choose the past. Choose the future: Modules. In early drafts of the ES6 modules specification, there was an inline modules notion, which then has been eliminated in September 2013. However, this notion was already implemented by the TypeScript team, in 2012, with the first beta versions of the language: it was internal … Read more

Configure a generic jQuery plugin with Browserify-shim?

After revisiting this and trying some more things, I finally wrapped my head around what browserify-shim is doing and how to use it. For me, there was one key principle I had to grasp before I finally understood how to use browserify-shim. There are basically two ways to use browserify-shim for two different use cases: … Read more

How do I manage relative path aliasing in multiple grunt-browserify bundles?

Simple answer: The simplest is to use the paths option of browserify. I use it for some months with great success. I have even made a starter kit that uses this feature: https://github.com/stample/gulp-browserify-react-phonegap-starter var b = browserify(‘./app’, {paths: [‘./node_modules’,’./src/js’]}); paths – require.paths array to use if nothing is found on the normal node_modules recursive walk … Read more

How do I use Browserify with external dependencies?

You can achieve that by using browserify-shim. Assuming that you’ve got a module named mymodule.js that depends on jQuery in the global scope with the following contents: var $ = require(‘jQuery’); console.log(typeof $); Install browserify-shim: npm install browserify-shim –save-dev In package.json file, tell browserify to use browserify-shim as a transform: { “browserify”: { “transform”: [ … Read more

Vue JS 2.0 not rendering anything?

Just to make life easier for folks looking for the answer: import Vue from ‘vue/dist/vue.js’ import App from ‘./App.vue’ new Vue({ el: ‘#app’, render: h => h(App) }) From the author — 2.0 standalone build means (compiler + runtime). The default export of the NPM package will be runtime only, because if installing from NPM, … Read more

Is there a way to render multiple React components in the React.render() function?

Since the React v16.0 release you can render an array of components without wrapping items in an extra element when you are inside a component: render() { return [ <li key=”one”>First item</li>, <li key=”two”>Second item</li>, <li key=”three”>Third item</li>, <li key=”four”>Fourth item</li>, ]; } Remember only to set the keys. UPDATE Now from the 16.2 version … Read more