mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-30 12:54:31 +01:00
Supply main sourcemaps only in dev builds
This commit is contained in:
parent
ecd22e4d45
commit
e751d24b35
@ -30,10 +30,13 @@
|
||||
"lint": "tslint 'src/**/*.ts'",
|
||||
"lint:fix": "tslint 'src/**/*.ts' --fix",
|
||||
"build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"",
|
||||
"build:dev": "NODE_ENV='development' npm run build",
|
||||
"build:main": "webpack --config webpack.main.js",
|
||||
"build:main:dev": "NODE_ENV='development' npm run build:main",
|
||||
"build:renderer": "gulp prebuild:renderer && webpack --config webpack.renderer.js",
|
||||
"build:renderer:watch": "gulp prebuild:renderer && webpack --config webpack.renderer.js --watch",
|
||||
"electron": "npm run build:main && concurrently -k -n Main,Rend -c yellow,cyan \"electron --inspect=5858 ./build --watch\" \"npm run build:renderer:watch\"",
|
||||
"build:renderer:dev": "NODE_ENV='development' npm run build:renderer",
|
||||
"build:renderer:watch": "NODE_ENV='development' gulp prebuild:renderer && webpack --config webpack.renderer.js --watch",
|
||||
"electron": "npm run build:main:dev && concurrently -k -n Main,Rend -c yellow,cyan \"electron --inspect=5858 ./build --watch\" \"npm run build:renderer:watch\"",
|
||||
"clean:dist": "rimraf ./dist/*",
|
||||
"clean:l10n": "git push origin --delete l10n_master",
|
||||
"pack:dir": "npm run clean:dist && electron-builder --dir -p never",
|
||||
|
@ -5,6 +5,8 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||
|
||||
const NODE_ENV = process.env.NODE_ENV == null ? 'production' : process.env.NODE_ENV;
|
||||
|
||||
const common = {
|
||||
module: {
|
||||
rules: [
|
||||
@ -25,16 +27,26 @@ const common = {
|
||||
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: 'production',
|
||||
mode: NODE_ENV,
|
||||
target: 'electron-main',
|
||||
node: {
|
||||
__dirname: false,
|
||||
@ -67,4 +79,4 @@ const main = {
|
||||
externals: [nodeExternals()],
|
||||
};
|
||||
|
||||
module.exports = merge(common, main);
|
||||
module.exports = merge(common, NODE_ENV === 'development' ? dev : prod, main);
|
||||
|
Loading…
Reference in New Issue
Block a user