mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-03 14:06:25 +01:00
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import path from 'path';
|
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
import webpack from 'webpack';
|
|
|
|
// Generate inline script hosted on https://connect.trezor.io/X/trezor-connect.js
|
|
// This is compiled and polyfilled npm package without Core logic
|
|
|
|
const config: webpack.Configuration = {
|
|
target: 'web',
|
|
mode: 'production',
|
|
entry: {
|
|
'trezor-connect': path.resolve(__dirname, '../src/index.ts'),
|
|
'trezor-connect.min': path.resolve(__dirname, '../src/index.ts'),
|
|
},
|
|
output: {
|
|
filename: '[name].js',
|
|
path: path.resolve(__dirname, '../build'),
|
|
publicPath: './',
|
|
library: 'TrezorConnect',
|
|
libraryTarget: 'umd',
|
|
libraryExport: 'default',
|
|
},
|
|
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: ['babel-loader'],
|
|
},
|
|
{
|
|
test: /\.ts$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-typescript'],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
// todo: this block is identical in connect-web
|
|
resolve: {
|
|
modules: ['node_modules'],
|
|
mainFields: ['browser', 'module', 'main'],
|
|
extensions: ['.ts', '.js'],
|
|
fallback: {
|
|
fs: false, // ignore "fs" import in markdown-it-imsize
|
|
path: false, // ignore "path" import in markdown-it-imsize
|
|
},
|
|
},
|
|
performance: {
|
|
hints: false,
|
|
},
|
|
|
|
optimization: {
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
exclude: /trezor-connect.js/,
|
|
extractComments: false,
|
|
terserOptions: {
|
|
format: {
|
|
comments: false,
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
},
|
|
};
|
|
|
|
export default config;
|