1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00
bitwarden-browser/webpack.main.js
Oscar Hinton 296340a5be
Add jslib as a "real" dependency (#941)
* Add jslib as a "real" dependency

* Move more packages to jslib

* Remove some unesessary dev dependencies.

* Add back missing preinstall

* Revert jslib bump

* Fix jslib containing wrong types/node.

* Bump jslib

* Remove unessesary alias

* Remove dummy module
2021-06-07 19:26:36 +02:00

69 lines
1.7 KiB
JavaScript

const path = require('path');
const { merge } = require('webpack-merge');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const common = {
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader',
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules\/(?!(@bitwarden)\/).*/,
},
],
},
plugins: [],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [new TsconfigPathsPlugin({ configFile: './tsconfig.json' })]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'build'),
},
};
const main = {
mode: 'production',
target: 'electron-main',
node: {
__dirname: false,
__filename: false,
},
entry: {
'main': './src/entry.ts',
},
optimization: {
minimize: false,
},
module: {
rules: [
{
test: /\.node$/,
loader: 'node-loader',
},
],
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [
'./src/package.json',
{ from: './src/images', to: 'images' },
{ from: './src/locales', to: 'locales' },
]
}),
],
externals: [nodeExternals()],
};
module.exports = merge(common, main);