40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const path = require('path')
|
|
const webpack = require('webpack')
|
|
const FixObjectCallPlugin = require('./plugins/fixObjectCallPlugin');
|
|
|
|
function resolve(dir) {
|
|
return path.join(__dirname, '..', dir)
|
|
}
|
|
|
|
module.exports = {
|
|
entry: './index.js',
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'weapp-socket.io.js',
|
|
libraryTarget: 'umd',
|
|
},
|
|
plugins: [
|
|
new webpack.NormalModuleReplacementPlugin(
|
|
/debug/,
|
|
path.resolve(__dirname, './lib/support/noop.js')
|
|
),
|
|
new webpack.NormalModuleReplacementPlugin(/^engine.io-client$/, path.resolve(__dirname, './lib/engine.io-client')),
|
|
new webpack.NormalModuleReplacementPlugin(/url\.js$/, path.resolve(__dirname, './lib/socket.io-client/lib/url.js')),
|
|
new FixObjectCallPlugin(),
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
loader: 'babel-loader',
|
|
include: [resolve('lib')],
|
|
options: {
|
|
presets: ['@babel/preset-env'],
|
|
plugins: ['@babel/plugin-transform-modules-commonjs']
|
|
}
|
|
},
|
|
],
|
|
},
|
|
mode: 'production',
|
|
}
|