Skip to content

Instantly share code, notes, and snippets.

@zpao
Created September 11, 2017 16:42
Show Gist options
  • Save zpao/f4a6e9647abda48928cffb90b0ef5e50 to your computer and use it in GitHub Desktop.
Save zpao/f4a6e9647abda48928cffb90b0ef5e50 to your computer and use it in GitHub Desktop.
{
"presets": ["./.babelrc.js"],
}
const fbjsMM = require('fbjs/module-map')
const myMM = Object.assign({}, fbjsMM, {
'./original': './rewritten',
});
module.exports = {
"plugins": [
["babel-preset-fbjs/plugins/rewrite-modules", {
map: myMM,
prefix: '',
}]
],
}
require('./original');
// fbjs module
const invariant = require('invariant');
invariant(false, 'hello world');
console.log('original')
console.log('rewritten')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment