forked from weapp-socketio/weapp.socket.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
33 lines (32 loc) · 960 Bytes
/
webpack.config.dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const webpack = require('webpack');
const path = require('path');
module.exports = {
mode: 'development',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'weapp.socket.io.dev.js',
libraryTarget: 'umd',
},
devtool: 'source-map',
plugins: [
new webpack.NormalModuleReplacementPlugin(/debug/g, process.cwd() + '/support/debug.js'),
new webpack.NormalModuleReplacementPlugin(/^ws$/g, process.cwd() + '/src/wx-ws.js'),
new webpack.NormalModuleReplacementPlugin(/^.\/transports\/index$/g, process.cwd() + '/src/transport.js'),
],
module: {
rules: [{
test: /engine.io-client\/lib\/socket.js$/,
loader: 'string-replace-loader',
options: {
multiple: [{
search: '["polling", "websocket"]',
replace: '["websocket"]',
}, {
search: "['polling', 'websocket']",
replace: "['websocket']",
}]
}
}]
}
};