npm i && npm test
Created
August 29, 2016 22:13
-
-
Save Rich-Harris/500d772653cfc2f3dddc4e4b20af8798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
function interopDefault(ex) { | |
return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex; | |
} | |
function createCommonjsModule(fn, module) { | |
return module = { exports: {} }, fn(module, module.exports), module.exports; | |
} | |
var commonjsBar = createCommonjsModule(function (module, exports) { | |
function Bar () { | |
this.x = 42; | |
} | |
exports.default = Bar; | |
}); | |
var commonjsBar$1 = interopDefault(commonjsBar); | |
var require$$0 = Object.freeze({ | |
default: commonjsBar$1 | |
}); | |
var commonjsFoo = createCommonjsModule(function (module, exports) { | |
var Bar = interopDefault(require$$0); | |
console.log( 'Bar', Bar ) | |
exports.Bar = Bar.default; | |
}); | |
interopDefault(commonjsFoo); | |
var Bar = commonjsFoo.Bar; | |
console.log( new Bar().x ); | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Bar () { | |
this.x = 42; | |
} | |
exports.default = Bar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bar = require( './commonjs-bar' ); | |
console.log( 'Bar', Bar ) | |
exports.Bar = Bar.default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Bar } from './commonjs-foo.js'; | |
console.log( new Bar().x ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"test": "rollup -c && node bundle.js" | |
}, | |
"devDependencies": { | |
"rollup": "^0.34.10", | |
"rollup-plugin-commonjs": "^3.3.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import commonjs from 'rollup-plugin-commonjs'; | |
export default { | |
entry: 'index.js', | |
dest: 'bundle.js', | |
plugins: [ | |
commonjs({ | |
include: [ 'commonjs-*.js' ] | |
}), | |
], | |
format: 'iife', | |
moduleName: 'gh_866' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment