Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Refactor) : Updated few dependencies related to : Webpack, React, Style-loader #185

Merged
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
28 changes: 14 additions & 14 deletions configs/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* Base webpack config used across other specific configs
*/

import path from 'path';
import webpack from 'webpack';
import { dependencies as externals } from '../app/package.json';
const path = require('path');
const webpack = require('webpack');
const { dependencies: externals } = require('../app/package.json');

export default {
module.exports = {
// Explicitly exclude node-gyp. This causes some issues on macOS otherwise when yarn install is run.
externals: ['node-gyp', ...Object.keys(externals || {})],

Expand All @@ -18,30 +18,30 @@ export default {
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
}
]
cacheDirectory: true,
},
},
},
],
},

output: {
path: path.join(__dirname, '..', 'app'),
// https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2'
libraryTarget: 'commonjs2',
},

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

plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production'
})
]
NODE_ENV: 'production',
}),
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* Webpack config for production electron main process
*/

import path from 'path';
import webpack from 'webpack';
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 '../internals/scripts/CheckNodeEnv';
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const baseConfig = require('./webpack.config.base');
const CheckNodeEnv = require('../internals/scripts/CheckNodeEnv');

CheckNodeEnv('production');

export default merge(baseConfig, {
module.exports = merge(baseConfig, {
devtool: 'source-map',

mode: 'production',
Expand All @@ -23,7 +23,7 @@ export default merge(baseConfig, {

output: {
path: path.join(__dirname, '..'),
filename: './app/main.prod.js'
filename: './app/main.prod.js',
},

optimization: {
Expand All @@ -32,17 +32,14 @@ export default merge(baseConfig, {
: [
new TerserPlugin({
parallel: true,
sourceMap: true,
cache: true
})
]
}),
],
},

plugins: [
new BundleAnalyzerPlugin({
analyzerMode:
process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
openAnalyzer: process.env.OPEN_ANALYZER === 'true'
analyzerMode: process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
openAnalyzer: process.env.OPEN_ANALYZER === 'true',
}),

/**
Expand All @@ -57,8 +54,8 @@ export default merge(baseConfig, {
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
DEBUG_PROD: false,
START_MINIMIZED: false
})
START_MINIMIZED: false,
}),
],

/**
Expand All @@ -68,6 +65,6 @@ export default merge(baseConfig, {
*/
node: {
__dirname: false,
__filename: false
}
__filename: false,
},
});
Loading