Files
BrowserOS/apps/controller-ext/webpack.config.js
Dani Akash 038056161e feat: setup biome as the new linter (#114)
* feat: install biome

* chore: remove eslint

* chore: remove prettier

* chore: fix lint issues

* chore: added biome precommit hook
2025-12-23 21:58:41 +05:30

84 lines
2.0 KiB
JavaScript

const path = require('node:path')
const webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
module.exports = (_env, argv) => {
const isProduction = argv.mode === 'production'
return {
mode: isProduction ? 'production' : 'development',
entry: {
background: './src/background/index.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
clean: true,
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
module: {
rules: [
{
test: /\.ts$/,
use: {
loader: 'ts-loader',
options: {
onlyCompileBundledFiles: true,
compilerOptions: {
declaration: false,
declarationMap: false,
},
},
},
exclude: [/node_modules/, /\.(test|spec)\.(ts|tsx)$/],
},
],
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new CopyPlugin({
patterns: [
{ from: 'manifest.json', to: '.' },
{ from: 'assets', to: 'assets' },
],
}),
],
devtool: isProduction ? false : 'source-map',
optimization: {
splitChunks: false,
runtimeChunk: false,
minimize: isProduction,
minimizer: isProduction
? [
new TerserPlugin({
extractComments: false,
terserOptions: {
format: {
comments: false,
},
compress: {
// FIXME: nikhil - remove this later after few releases
drop_console: false,
drop_debugger: true,
},
},
}),
]
: [],
},
performance: {
hints: isProduction ? 'warning' : false,
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
}
}