Created
April 14, 2017 16:12
-
-
Save justincy/2b225d2f15429ccbfeb03a34c2e4f61e to your computer and use it in GitHub Desktop.
Minimized webpack manifest.js
This file contains hidden or 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(e) { | |
function r(n) { | |
if (t[n]) return t[n].exports; | |
var o = t[n] = { | |
i: n, | |
l: !1, | |
exports: {} | |
}; | |
return e[n].call(o.exports, o, o.exports, r), o.l = !0, o.exports | |
} | |
var n = window.webpackJsonp; | |
window.webpackJsonp = function(t, c, a) { | |
for (var u, i, f, l = 0, s = []; l < t.length; l++) i = t[l], o[i] && s.push(o[i][0]), o[i] = 0; | |
for (u in c) Object.prototype.hasOwnProperty.call(c, u) && (e[u] = c[u]); | |
for (n && n(t, c, a); s.length;) s.shift()(); | |
if (a) | |
for (l = 0; l < a.length; l++) f = r(r.s = a[l]); | |
return f | |
}; | |
var t = {}, | |
o = { | |
3: 0 | |
}; | |
r.e = function(e) { | |
function n() { | |
a.onerror = a.onload = null, clearTimeout(u); | |
var r = o[e]; | |
0 !== r && (r && r[1](new Error("Loading chunk " + e + " failed.")), o[e] = void 0) | |
} | |
if (0 === o[e]) return Promise.resolve(); | |
if (o[e]) return o[e][2]; | |
var t = new Promise(function(r, n) { | |
o[e] = [r, n] | |
}); | |
o[e][2] = t; | |
var c = document.getElementsByTagName("head")[0], | |
a = document.createElement("script"); | |
a.type = "text/javascript", a.charset = "utf-8", a.async = !0, a.timeout = 12e4, r.nc && a.setAttribute("nonce", r.nc), a.src = r.p + "" + e + "." + { | |
0: "ac089a8c4094ab8f72c7", | |
1: "a6b2f6626c9212174219", | |
2: "dee9b6af621c8c188279" | |
}[e] + ".js"; | |
var u = setTimeout(n, 12e4); | |
return a.onerror = a.onload = n, c.appendChild(a), t | |
}, r.m = e, r.c = t, r.i = function(e) { | |
return e | |
}, r.d = function(e, n, t) { | |
r.o(e, n) || Object.defineProperty(e, n, { | |
configurable: !1, | |
enumerable: !0, | |
get: t | |
}) | |
}, r.n = function(e) { | |
var n = e && e.__esModule ? function() { | |
return e.default | |
} : function() { | |
return e | |
}; | |
return r.d(n, "a", n), n | |
}, r.o = function(e, r) { | |
return Object.prototype.hasOwnProperty.call(e, r) | |
}, r.p = "", r.oe = function(e) { | |
throw console.error(e), e | |
} | |
}([]); |
This file contains hidden or 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 webpack = require('webpack'); | |
var path = require('path'); | |
var AssetsPlugin = require('assets-webpack-plugin'); | |
module.exports = function(env) { | |
var config = { | |
entry: { | |
settings: './lib/pages/search/settings.js', | |
search: './lib/pages/search/search.js' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /(node_modules|bower_components)/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['env','es2015','react'] | |
} | |
} | |
} | |
] | |
}, | |
output: { | |
filename: '[name].[chunkhash].js', | |
path: path.resolve(__dirname, 'assets', 'js') | |
}, | |
plugins: [ | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
minChunks: function (module) { | |
// this assumes your vendor imports exist in the node_modules directory | |
return module.context && module.context.indexOf('node_modules') !== -1; | |
} | |
}), | |
//CommonChunksPlugin will now extract all the common modules from vendor and main bundles | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'manifest' //But since there are no more common modules between them we end up with just the runtime code included in the manifest file | |
}), | |
new AssetsPlugin() | |
] | |
}; | |
if(env && env.production){ | |
config.plugins.push(new webpack.optimize.UglifyJsPlugin()); | |
} | |
return config; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment