mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-04 18:37:45 +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": "tslint 'src/**/*.ts'",
|
||||||
"lint:fix": "tslint 'src/**/*.ts' --fix",
|
"lint:fix": "tslint 'src/**/*.ts' --fix",
|
||||||
"build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"",
|
"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": "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": "gulp prebuild:renderer && webpack --config webpack.renderer.js",
|
||||||
"build:renderer:watch": "gulp prebuild:renderer && webpack --config webpack.renderer.js --watch",
|
"build:renderer:dev": "NODE_ENV='development' npm run build:renderer",
|
||||||
"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: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:dist": "rimraf ./dist/*",
|
||||||
"clean:l10n": "git push origin --delete l10n_master",
|
"clean:l10n": "git push origin --delete l10n_master",
|
||||||
"pack:dir": "npm run clean:dist && electron-builder --dir -p never",
|
"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 nodeExternals = require('webpack-node-externals');
|
||||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||||
|
|
||||||
|
const NODE_ENV = process.env.NODE_ENV == null ? 'production' : process.env.NODE_ENV;
|
||||||
|
|
||||||
const common = {
|
const common = {
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
@ -25,16 +27,26 @@ const common = {
|
|||||||
extensions: ['.tsx', '.ts', '.js'],
|
extensions: ['.tsx', '.ts', '.js'],
|
||||||
plugins: [new TsconfigPathsPlugin({ configFile: './tsconfig.json' })]
|
plugins: [new TsconfigPathsPlugin({ configFile: './tsconfig.json' })]
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const prod = {
|
||||||
|
output: {
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.resolve(__dirname, 'build'),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const dev = {
|
||||||
output: {
|
output: {
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
path: path.resolve(__dirname, 'build'),
|
path: path.resolve(__dirname, 'build'),
|
||||||
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
|
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
|
||||||
},
|
},
|
||||||
devtool: 'cheap-source-map'
|
devtool: 'cheap-source-map'
|
||||||
};
|
}
|
||||||
|
|
||||||
const main = {
|
const main = {
|
||||||
mode: 'production',
|
mode: NODE_ENV,
|
||||||
target: 'electron-main',
|
target: 'electron-main',
|
||||||
node: {
|
node: {
|
||||||
__dirname: false,
|
__dirname: false,
|
||||||
@ -67,4 +79,4 @@ const main = {
|
|||||||
externals: [nodeExternals()],
|
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