38 lines
784 B
JavaScript
38 lines
784 B
JavaScript
const path = require('path');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
|
|
module.exports = (env, argv) => {
|
|
const isProduction = argv.mode === 'production';
|
|
|
|
return {
|
|
entry: './src/main.ts',
|
|
output: {
|
|
filename: 'main.js',
|
|
path: path.resolve(__dirname, 'onchain_lib'),
|
|
},
|
|
resolve: {
|
|
extensions: ['.ts', '.tsx', '.js', '.json'],
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
],
|
|
},
|
|
optimization: {
|
|
minimize: isProduction,
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true,
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
},
|
|
};
|
|
}; |