d164512c4e
GitOrigin-RevId: 2aebf9a549a32a3b06e82187e032d82e859bf4a0
80 lines
1.6 KiB
JavaScript
80 lines
1.6 KiB
JavaScript
const path = require('path');
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
module.exports = {
|
|
entry: ['./src/index.js'],
|
|
output: {
|
|
filename: 'tdweb.js',
|
|
path: path.resolve(__dirname, 'dist'),
|
|
library: 'tdweb',
|
|
libraryTarget: 'umd',
|
|
umdNamedDefine: true
|
|
},
|
|
devServer: {
|
|
contentBase: './dist'
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin(),
|
|
new CleanWebpackPlugin(['dist'], {})
|
|
//, new UglifyJSPlugin()
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /prebuilt/,
|
|
enforce: 'pre',
|
|
include: [path.resolve(__dirname, 'src')],
|
|
use: [
|
|
{
|
|
loader: require.resolve('eslint-loader')
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /worker\.(js|jsx)$/,
|
|
include: [path.resolve(__dirname, 'src')],
|
|
use: [
|
|
{
|
|
loader: require.resolve('worker-loader')
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /prebuilt/,
|
|
include: [path.resolve(__dirname, 'src')],
|
|
use: [
|
|
{
|
|
loader: require.resolve('babel-loader')
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.(wasm|mem)$/,
|
|
include: [path.resolve(__dirname, 'src')],
|
|
use: [
|
|
{
|
|
loader: require.resolve('file-loader')
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
node: {
|
|
dgram: 'empty',
|
|
fs: 'empty',
|
|
net: 'empty',
|
|
tls: 'empty',
|
|
crypto: 'empty',
|
|
child_process: 'empty'
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
ws$: 'fs'
|
|
}
|
|
}
|
|
};
|