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