Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,45 @@
* Base webpack config used across other specific configs
*/

import path from 'path';
import webpack from 'webpack';
import { dependencies as externals } from '../../src/package.json';
import webpackPaths from './webpack.paths';
import { dependencies as externals } from '../../release/app/package.json';

export default {
externals: [...Object.keys(externals || {})],

stats: 'errors-only',

module: {
rules: [
{
test: /\.tsx?$/,
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
loader: 'ts-loader',
options: {
cacheDirectory: true,
// Remove this line to enable type checking in webpack builds
transpileOnly: true,
},
},
},
],
},

output: {
path: path.join(__dirname, '../../src'),
path: webpackPaths.srcPath,
// https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2',
library: {
type: 'commonjs2',
},
},

/**
* Determine the array of extensions that should be used to resolve modules.
*/
resolve: {
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: [path.join(__dirname, '../../src'), 'node_modules'],
modules: [webpackPaths.srcPath, 'node_modules'],
},

plugins: [
Expand Down
4 changes: 0 additions & 4 deletions .erb/configs/webpack.config.eslint.js

This file was deleted.

3 changes: 3 additions & 0 deletions .erb/configs/webpack.config.eslint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* eslint import/no-unresolved: off, import/no-self-import: off */

module.exports = require('./webpack.config.renderer.dev').default;
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import { merge } from 'webpack-merge';
import TerserPlugin from 'terser-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import baseConfig from './webpack.config.base';
import CheckNodeEnv from '../scripts/CheckNodeEnv';
import DeleteSourceMaps from '../scripts/DeleteSourceMaps';
import webpackPaths from './webpack.paths';
import checkNodeEnv from '../scripts/check-node-env';
import deleteSourceMaps from '../scripts/delete-source-maps';

CheckNodeEnv('production');
DeleteSourceMaps();
checkNodeEnv('production');
deleteSourceMaps();

const devtoolsConfig =
process.env.DEBUG_PROD === 'true'
Expand All @@ -28,11 +29,14 @@ export default merge(baseConfig, {

target: 'electron-main',

entry: './src/main.dev.ts',
entry: {
main: path.join(webpackPaths.srcMainPath, 'main.ts'),
preload: path.join(webpackPaths.srcMainPath, 'preload.js'),
},

output: {
path: path.join(__dirname, '../../'),
filename: './src/main.prod.js',
path: webpackPaths.distMainPath,
filename: '[name].js',
},

optimization: {
Expand All @@ -44,11 +48,8 @@ export default merge(baseConfig, {
},

plugins: [
new webpack.IgnorePlugin({ resourceRegExp: /^pg-native$/ }),
new BundleAnalyzerPlugin({
analyzerMode:
process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
openAnalyzer: process.env.OPEN_ANALYZER === 'true',
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
}),

/**
Expand Down
Loading