mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-19 23:52:06 +00:00
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
import webpack from 'webpack'
|
|
import TerserPlugin from 'terser-webpack-plugin'
|
|
import info from 'webtorrent/package.json' assert { type: 'json' }
|
|
|
|
/** @type {import('webpack').Configuration} */
|
|
export default {
|
|
entry: './index.js',
|
|
devtool: 'source-map',
|
|
resolve: {
|
|
aliasFields: ['chromeapp'],
|
|
alias: {
|
|
...info.chromeapp,
|
|
path: 'path-esm',
|
|
stream: 'stream-browserify',
|
|
timers: 'timers-browserify',
|
|
crypto: 'crypto-browserify',
|
|
buffer: 'buffer',
|
|
querystring: 'querystring',
|
|
zlib: '/polyfills/inflate-sync-web.js'
|
|
}
|
|
},
|
|
output: {
|
|
chunkFormat: 'module',
|
|
filename: 'webtorrent.chromeapp.js',
|
|
library: {
|
|
type: 'module'
|
|
}
|
|
},
|
|
mode: 'production',
|
|
target: 'web',
|
|
experiments: {
|
|
outputModule: true
|
|
},
|
|
plugins: [
|
|
new webpack.ProvidePlugin({
|
|
process: '/polyfills/process-fast.js',
|
|
Buffer: ['buffer', 'Buffer']
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
global: 'globalThis'
|
|
})
|
|
],
|
|
optimization: {
|
|
minimize: true,
|
|
minimizer: [new TerserPlugin({
|
|
terserOptions: {
|
|
format: {
|
|
comments: false
|
|
}
|
|
},
|
|
extractComments: false
|
|
})]
|
|
}
|
|
}
|