forked from socketio/socket.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Update webpack example (socketio#2960)
- Loading branch information
1 parent
1690329
commit a60d82e
Showing
6 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
33 changes: 33 additions & 0 deletions
33
examples/webpack-build/support/webpack.config.json-parser.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
var webpack = require('webpack'); | ||
|
||
module.exports = { | ||
entry: './lib/index.js', | ||
output: { | ||
path: require('path').join(__dirname, '../dist'), | ||
filename: 'app.json-parser.js' | ||
}, | ||
// generate sourcemap | ||
devtool: 'source-map', | ||
plugins: [ | ||
// replace require('debug')() with an noop function | ||
new webpack.NormalModuleReplacementPlugin(/debug/, process.cwd() + '/support/noop.js'), | ||
// replace socket.io-parser with socket.io-json-parser | ||
new webpack.NormalModuleReplacementPlugin(/socket\.io-parser/, 'socket.io-json-parser'), | ||
// use uglifyJS (IE9+ support) | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
}) | ||
], | ||
module: { | ||
loaders: [ | ||
{ | ||
// strip `debug()` calls | ||
test: /\.js$/, | ||
loader: 'strip-loader?strip[]=debug' | ||
} | ||
] | ||
} | ||
}; |
This file contains 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
This file contains 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