mirror of
https://github.com/LukeHagar/firecamp.git
synced 2025-12-07 20:37:45 +00:00
chore: webpack env optimization
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
require('dotenv').config();
|
||||
/* eslint-disable no-console */
|
||||
require('dotenv-vault-core').config();
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
console.log(process.env.FIRECAMP_API_HOST, 'FIRECAMP_API_HOST'); // for debugging purposes. remove when ready.
|
||||
|
||||
@@ -29,13 +28,6 @@ const common = {
|
||||
),
|
||||
},
|
||||
optimization: {
|
||||
nodeEnv: process.env.NODE_ENV,
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: 2,
|
||||
}),
|
||||
],
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
// name: 'vendor',
|
||||
|
||||
@@ -13,6 +13,9 @@ module.exports = merge(base, {
|
||||
mode: 'development',
|
||||
devtool: 'cheap-module-source-map',
|
||||
output: { clean: true },
|
||||
optimization: {
|
||||
nodeEnv: 'development'
|
||||
},
|
||||
devServer: {
|
||||
//server: 'https',
|
||||
static: path.join(__dirname, './build/development'),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const { merge } = require('webpack-merge');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
// const CompressionPlugin = require('compression-webpack-plugin');
|
||||
const base = require('./webpack.common');
|
||||
|
||||
@@ -15,6 +16,15 @@ const config = merge(base, {
|
||||
chunkFilename: '[name].bundle.js',
|
||||
path: path.join(__dirname, `./build/${nodeEnv}`),
|
||||
},
|
||||
optimization: {
|
||||
nodeEnv: 'production',
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: 2,
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
React: 'react',
|
||||
|
||||
Reference in New Issue
Block a user