Skip to content

Commit e27f38b

Browse files
atogatadarrachequesne
authored andcommittedMar 1, 2018
[chore] Restore unminified distribution files (#1191)
1 parent bb743c4 commit e27f38b

6 files changed

+97
-70
lines changed
 

‎gulpfile.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ gulp.task('build', function () {
2121
.pipe(webpack({
2222
config: [
2323
require('./support/webpack.config.js'),
24-
require('./support/webpack.config.slim.js')
24+
require('./support/webpack.config.dev.js'),
25+
require('./support/webpack.config.slim.js'),
26+
require('./support/webpack.config.slim.dev.js')
2527
]
2628
}))
2729
.pipe(gulp.dest(BUILD_TARGET_DIR));

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"socket.io": "2.0.4",
5252
"strip-loader": "0.1.2",
5353
"text-blob-builder": "0.0.1",
54+
"webpack-merge": "4.1.2",
5455
"webpack-stream": "3.2.0",
5556
"zuul": "^3.11.1 ",
5657
"zuul-builder-webpack": "^1.2.0",

‎support/webpack.config.dev.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
var webpack = require('webpack');
3+
4+
module.exports = {
5+
name: 'default',
6+
entry: './lib/index.js',
7+
output: {
8+
library: 'io',
9+
libraryTarget: 'umd',
10+
filename: 'socket.io.dev.js'
11+
},
12+
externals: {
13+
global: glob()
14+
},
15+
devtool: 'source-map',
16+
module: {
17+
loaders: [{
18+
test: /\.js$/,
19+
exclude: /(node_modules|bower_components)/,
20+
loader: 'babel', // 'babel-loader' is also a legal name to reference
21+
query: { presets: ['es2015'] }
22+
}, {
23+
test: /\json3.js/,
24+
loader: 'imports?define=>false'
25+
}]
26+
}
27+
};
28+
29+
/**
30+
* Populates `global`.
31+
*
32+
* @api private
33+
*/
34+
35+
function glob () {
36+
return 'typeof self !== "undefined" ? self : ' +
37+
'typeof window !== "undefined" ? window : ' +
38+
'typeof global !== "undefined" ? global : {}';
39+
}

‎support/webpack.config.js

+4-32
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
21
var webpack = require('webpack');
2+
var merge = require('webpack-merge');
3+
var baseConfig = require('./webpack.config.dev.js')
34

4-
module.exports = {
5-
name: 'default',
6-
entry: './lib/index.js',
5+
module.exports = merge(baseConfig, {
76
output: {
87
library: 'io',
98
libraryTarget: 'umd',
109
filename: 'socket.io.js'
1110
},
12-
externals: {
13-
global: glob()
14-
},
15-
devtool: 'source-map',
1611
plugins: [
1712
new webpack.optimize.UglifyJsPlugin({
1813
compress: {
@@ -27,27 +22,4 @@ module.exports = {
2722
}
2823
})
2924
],
30-
module: {
31-
loaders: [{
32-
test: /\.js$/,
33-
exclude: /(node_modules|bower_components)/,
34-
loader: 'babel', // 'babel-loader' is also a legal name to reference
35-
query: { presets: ['es2015'] }
36-
}, {
37-
test: /\json3.js/,
38-
loader: 'imports?define=>false'
39-
}]
40-
}
41-
};
42-
43-
/**
44-
* Populates `global`.
45-
*
46-
* @api private
47-
*/
48-
49-
function glob () {
50-
return 'typeof self !== "undefined" ? self : ' +
51-
'typeof window !== "undefined" ? window : ' +
52-
'typeof global !== "undefined" ? global : {}';
53-
}
25+
});

‎support/webpack.config.slim.dev.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
var webpack = require('webpack');
3+
4+
module.exports = {
5+
name: 'slim',
6+
entry: './lib/index.js',
7+
output: {
8+
library: 'io',
9+
libraryTarget: 'umd',
10+
filename: 'socket.io.slim.dev.js'
11+
},
12+
externals: {
13+
global: glob(),
14+
json3: 'JSON'
15+
},
16+
devtool: 'source-map',
17+
plugins: [
18+
new webpack.NormalModuleReplacementPlugin(/debug/, process.cwd() + '/support/noop.js'),
19+
],
20+
module: {
21+
loaders: [{
22+
test: /\.js$/,
23+
exclude: /(node_modules|bower_components)/,
24+
loader: 'babel', // 'babel-loader' is also a legal name to reference
25+
query: { presets: ['es2015'] }
26+
}, {
27+
test: /\json3.js/,
28+
loader: 'imports?define=>false'
29+
}, {
30+
test: /\.js$/,
31+
loader: 'strip-loader?strip[]=debug'
32+
}]
33+
}
34+
};
35+
36+
/**
37+
* Populates `global`.
38+
*
39+
* @api private
40+
*/
41+
42+
function glob () {
43+
return 'typeof self !== "undefined" ? self : ' +
44+
'typeof window !== "undefined" ? window : ' +
45+
'typeof global !== "undefined" ? global : {}';
46+
}

‎support/webpack.config.slim.js

+4-37
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,14 @@
1-
21
var webpack = require('webpack');
2+
var merge = require('webpack-merge');
3+
var baseConfig = require('./webpack.config.slim.dev.js')
34

4-
module.exports = {
5-
name: 'slim',
6-
entry: './lib/index.js',
5+
module.exports = merge(baseConfig, {
76
output: {
87
library: 'io',
98
libraryTarget: 'umd',
109
filename: 'socket.io.slim.js'
1110
},
12-
externals: {
13-
global: glob(),
14-
json3: 'JSON'
15-
},
16-
devtool: 'source-map',
1711
plugins: [
18-
new webpack.NormalModuleReplacementPlugin(/debug/, process.cwd() + '/support/noop.js'),
1912
new webpack.optimize.UglifyJsPlugin()
2013
],
21-
module: {
22-
loaders: [{
23-
test: /\.js$/,
24-
exclude: /(node_modules|bower_components)/,
25-
loader: 'babel', // 'babel-loader' is also a legal name to reference
26-
query: { presets: ['es2015'] }
27-
}, {
28-
test: /\json3.js/,
29-
loader: 'imports?define=>false'
30-
}, {
31-
test: /\.js$/,
32-
loader: 'strip-loader?strip[]=debug'
33-
}]
34-
}
35-
};
36-
37-
/**
38-
* Populates `global`.
39-
*
40-
* @api private
41-
*/
42-
43-
function glob () {
44-
return 'typeof self !== "undefined" ? self : ' +
45-
'typeof window !== "undefined" ? window : ' +
46-
'typeof global !== "undefined" ? global : {}';
47-
}
14+
});

0 commit comments

Comments
 (0)
Please sign in to comment.