mirror of
https://github.com/bitwarden/browser.git
synced 2024-08-23 22:43:00 +02:00
* Implement argon2 * Remove argon2 webassembly warning * Replace magic numbers by enum * move packages * cleanup call to argon2 * update call to node argon2 * don't need wasm-eval * revert config changes * Update libs/common/src/enums/kdfType.ts Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com> * Update kdfType.ts * apply DEFAULT_PBKDF2_ITERATIONS * checkIfWasmSupported Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com>
91 lines
2.1 KiB
JavaScript
91 lines
2.1 KiB
JavaScript
const path = require("path");
|
|
const { merge } = require("webpack-merge");
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
const configurator = require("./config/config");
|
|
const { EnvironmentPlugin } = require("webpack");
|
|
|
|
const NODE_ENV = process.env.NODE_ENV == null ? "development" : process.env.NODE_ENV;
|
|
|
|
console.log("Main process config");
|
|
const envConfig = configurator.load(NODE_ENV);
|
|
configurator.log(envConfig);
|
|
|
|
const common = {
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: "ts-loader",
|
|
exclude: /node_modules\/(?!(@bitwarden)\/).*/,
|
|
},
|
|
],
|
|
},
|
|
plugins: [],
|
|
resolve: {
|
|
extensions: [".tsx", ".ts", ".js"],
|
|
plugins: [new TsconfigPathsPlugin({ configFile: "./tsconfig.json" })],
|
|
},
|
|
};
|
|
|
|
const prod = {
|
|
output: {
|
|
filename: "[name].js",
|
|
path: path.resolve(__dirname, "build"),
|
|
},
|
|
};
|
|
|
|
const dev = {
|
|
output: {
|
|
filename: "[name].js",
|
|
path: path.resolve(__dirname, "build"),
|
|
devtoolModuleFilenameTemplate: "[absolute-resource-path]",
|
|
},
|
|
devtool: "cheap-source-map",
|
|
};
|
|
|
|
const main = {
|
|
mode: NODE_ENV,
|
|
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" },
|
|
"../../node_modules/argon2-browser/dist/argon2.wasm",
|
|
],
|
|
}),
|
|
new EnvironmentPlugin({
|
|
FLAGS: envConfig.flags,
|
|
DEV_FLAGS: NODE_ENV === "development" ? envConfig.devFlags : {},
|
|
}),
|
|
],
|
|
externals: {
|
|
"electron-reload": "commonjs2 electron-reload",
|
|
"@bitwarden/desktop-native": "commonjs2 @bitwarden/desktop-native",
|
|
},
|
|
};
|
|
|
|
module.exports = merge(common, NODE_ENV === "development" ? dev : prod, main);
|