Skip to content

Instantly share code, notes, and snippets.

@schmod

schmod/test.js

Last active Apr 27, 2016
Embed
What would you like to do?
Webpack 2 vs Webpack 1 comparison
import angular from 'angular';
import moment from 'moment';
export default angular.module('foo', [])
.run(function(){
window.foo = moment();
});
var path = require('path');
var webpack = require('webpack');
module.exports = {
context: './',
entry: {
test: './test',
vendor: ['angular', 'moment']
},
output: {
path: path.join(__dirname, 'out'),
filename: '[name].bundle.js',
chunkFilename: '[id].chunk.js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
filename: 'vendor.js',
name: 'vendor'
}),
new webpack.optimize.UglifyJsPlugin()
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel',
query: {
// give babel absolute paths for all presets/plugins -- babel/webpack have problems
// resolving relative paths across symlinks
presets: ['babel-preset-es2015-webpack'].map(require.resolve),
// plugins: ['babel-plugin-transform-runtime', 'babel-plugin-angularjs-annotate'].map(require.resolve),
cacheDirectory: path.resolve('.tmp/babel')
}
}]
},
resolve: {
modules: [
path.resolve('.'),
path.resolve('node_modules')
]
},
resolveLoader: {
modules: [path.join(__dirname, 'node_modules')]
}
};
webpackJsonp([0],[function(e,u,o){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(u,"__esModule",{value:!0});var n=o(1),f=t(n),d=o(3),l=t(d);u["default"]=f["default"].module("foo",[]).run(function(){window.foo=(0,l["default"])()})}]);
webpackJsonp([0],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _angular = __webpack_require__(1);
var _angular2 = _interopRequireDefault(_angular);
var _moment = __webpack_require__(3);
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _angular2.default.module('foo', []).run(function () {
window.foo = (0, _moment2.default)();
});
/***/ }
]);
webpackJsonp([1],{103:function(e,u,o){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(u,"__esModule",{value:!0});var n=o(1),f=t(n),d=o(0),l=t(d);u["default"]=f["default"].module("foo",[]).run(function(){window.foo=(0,l["default"])()})}},[103]);
webpackJsonp([1],{
/***/ 103:
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _angular = __webpack_require__(1);
var _angular2 = _interopRequireDefault(_angular);
var _moment = __webpack_require__(0);
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _angular2.default.module('foo', []).run(function () {
window.foo = (0, _moment2.default)();
});
/***/ }
},[103]);
webpackJsonp([1],{103:function(e,n,t){var o=t(1),u=o&&o.__esModule?function(){return o["default"]}:function(){return o};Object.defineProperty(u,"a",{get:u});var r=t(0),f=r&&r.__esModule?function(){return r["default"]}:function(){return r};Object.defineProperty(f,"a",{get:f}),n["default"]=u.a.module("foo",[]).run(function(){window.foo=f.a.bind()()})}},[103]);
webpackJsonp([1],{
/***/ 103:
/***/ function(module, exports, __webpack_require__) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_angular__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_angular___default = __WEBPACK_IMPORTED_MODULE_0_angular__ && __WEBPACK_IMPORTED_MODULE_0_angular__.__esModule ? function() { return __WEBPACK_IMPORTED_MODULE_0_angular__['default'] } : function() { return __WEBPACK_IMPORTED_MODULE_0_angular__; }
/* harmony import */ Object.defineProperty(__WEBPACK_IMPORTED_MODULE_0_angular___default, 'a', { get: __WEBPACK_IMPORTED_MODULE_0_angular___default });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_moment__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_moment___default = __WEBPACK_IMPORTED_MODULE_1_moment__ && __WEBPACK_IMPORTED_MODULE_1_moment__.__esModule ? function() { return __WEBPACK_IMPORTED_MODULE_1_moment__['default'] } : function() { return __WEBPACK_IMPORTED_MODULE_1_moment__; }
/* harmony import */ Object.defineProperty(__WEBPACK_IMPORTED_MODULE_1_moment___default, 'a', { get: __WEBPACK_IMPORTED_MODULE_1_moment___default });
/* harmony default export */ exports["default"] = /* harmony import */__WEBPACK_IMPORTED_MODULE_0_angular___default.a.module('foo', []).run(function () {
window.foo = /* harmony import */__WEBPACK_IMPORTED_MODULE_1_moment___default.a.bind()();
});
/***/ }
},[103]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment