Eek out some file size
This commit is contained in:
parent
01b9e772d8
commit
6437d98f73
@ -4,6 +4,7 @@ var webpack = require('webpack');
|
||||
module.exports = function createWebpackConfig(_options) {
|
||||
var config;
|
||||
var options = _options || {};
|
||||
var env = options.env || 'development';
|
||||
|
||||
config = {
|
||||
context: options.context,
|
||||
@ -11,8 +12,17 @@ module.exports = function createWebpackConfig(_options) {
|
||||
|
||||
plugins: [
|
||||
new webpack.optimize.OccurrenceOrderPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify(env),
|
||||
},
|
||||
}),
|
||||
],
|
||||
|
||||
node: {
|
||||
process: false,
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ },
|
||||
@ -35,6 +45,9 @@ module.exports = function createWebpackConfig(_options) {
|
||||
config.plugins.push(
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compressor: {
|
||||
pure_getters: true,
|
||||
unsafe: true,
|
||||
unsafe_comps: true,
|
||||
screw_ie8: true,
|
||||
warnings: false,
|
||||
},
|
||||
@ -42,15 +55,5 @@ module.exports = function createWebpackConfig(_options) {
|
||||
);
|
||||
}
|
||||
|
||||
if (options.env) {
|
||||
config.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify(options.env),
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
@ -43,6 +43,7 @@ describe('u.freeze', () => {
|
||||
expect(Object.isFrozen(object.foo)).to.be.false;
|
||||
});
|
||||
|
||||
if (typeof process !== 'undefined') {
|
||||
it('does not freeze in production', () => {
|
||||
process.env.NODE_ENV = 'production';
|
||||
const object = {};
|
||||
@ -50,6 +51,7 @@ describe('u.freeze', () => {
|
||||
|
||||
expect(Object.isFrozen(object)).to.be.false;
|
||||
});
|
||||
}
|
||||
|
||||
it('handles null objects', () => {
|
||||
const object = { foo: null };
|
||||
|
Loading…
Reference in New Issue
Block a user