38 lines
1.1 KiB
JavaScript
38 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.dev.js',
|
|
libraryTarget: 'commonjs2',
|
|
},
|
|
devtool: 'source-map',
|
|
plugins: [
|
|
new webpack.NormalModuleReplacementPlugin(/debug/, path.resolve(__dirname, './lib/support/debug.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: 'development',
|
|
};
|