This is an example to my article “How webpack’s ContextReplacementPlugin works”
Each time webpack encounters a dynamic import like this:
require('./locale/' + name + '.js')
{ | |
"images" : [ | |
{ | |
"size" : "20x20", | |
"idiom" : "iphone", | |
"filename" : "Icon-App-20x20@2x.png", | |
"scale" : "2x" | |
}, | |
{ | |
"size" : "20x20", |
//: Playground - noun: a place where people can play | |
import Foundation | |
final class Disposable { | |
private let dispose: () -> () | |
init(_ dispose: @escaping () -> ()) { | |
self.dispose = dispose | |
} | |
This is an example to my article “How webpack’s ContextReplacementPlugin works”
Each time webpack encounters a dynamic import like this:
require('./locale/' + name + '.js')
this._panResponder = PanResponder.create({ | |
// ----------- NEGOTIATION: | |
// A view can become the touch responder by implementing the correct negotiation methods. | |
// Should child views be prevented from becoming responder on first touch? | |
onStartShouldSetPanResponderCapture: (evt, gestureState) => () => { | |
console.info('onStartShouldSetPanResponderCapture'); | |
return true; | |
}, |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
// early experiments with node had mysterious double requests | |
// turned out these were for the stoopid favicon | |
// here's how to short-circuit those requests | |
// and stop seeing 404 errors in your client console | |
var http = require('http'); | |
http.createServer(function (q, r) { | |
// control for favicon |