Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ const BUILD_TARGET_DIR = './dist/';

gulp.task('build', function () {
return gulp.src('lib/*.js')
.pipe(webpack(require('./support/webpack.config.js')))
.pipe(webpack({
config: [
require('./support/webpack.config.js'),
require('./support/webpack.config.slim.js')
]
}))
.pipe(minify({
ext: {
src: '.js',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@
"istanbul": "0.4.2",
"mocha": "2.3.4",
"socket.io": "1.6.0",
"strip-loader": "0.1.2",
"text-blob-builder": "0.0.1",
"uglify-js": "2.6.1",
"webpack-stream": "3.1.0",
"webpack-stream": "3.2.0",
"zuul": "3.11.0",
"zuul-builder-webpack": "1.1.0",
"zuul-ngrok": "4.0.0"
Expand Down
2 changes: 2 additions & 0 deletions support/noop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

module.exports = function () { return function () {}; };
1 change: 1 addition & 0 deletions support/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

module.exports = {
name: 'default',
entry: './lib/index.js',
output: {
library: 'io',
Expand Down
45 changes: 45 additions & 0 deletions support/webpack.config.slim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

var webpack = require('webpack');

module.exports = {
name: 'slim',
entry: './lib/index.js',
output: {
library: 'io',
libraryTarget: 'umd',
filename: 'socket.io.slim.js'
},
externals: {
global: glob()
},
devtool: 'cheap-module-source-map',
plugins: [
new webpack.NormalModuleReplacementPlugin(/(debug|json3)/, process.cwd() + '/support/noop.js')
],
module: {
loaders: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: { presets: ['es2015'] }
}, {
test: /\json3.js/,
loader: 'imports?define=>false'
}, {
test: /\.js$/,
loader: 'strip-loader?strip[]=debug'
}]
}
};

/**
* Populates `global`.
*
* @api private
*/

function glob () {
return 'typeof self !== "undefined" ? self : ' +
'typeof window !== "undefined" ? window : ' +
'typeof global !== "undefined" ? global : {}';
}