From 4d8779961d2f602376006453d6526d5d76352191 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Mon, 23 Aug 2021 15:03:44 +0100 Subject: [PATCH] Run production build if variable is set --- .circleci/config.yml | 8 ++++---- apps/debugger/webpack.config.js | 26 +++++++++++++++----------- apps/remix-ide/webpack.config.js | 26 +++++++++++++++----------- package.json | 1 + 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e2f5431ee1..5f8718c22a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ jobs: - checkout - run: npm install - run: npm run downloadsolc_assets - - run: npx nx build remix-ide --with-deps + - run: npm run build:production - run: name: Deploy command: | @@ -268,7 +268,7 @@ jobs: - setup_remote_docker - run: npm install - run: npm run downloadsolc_assets - - run: npx nx build remix-ide --with-deps + - run: npm run build:production - run: ./apps/remix-ide/ci/copy_resources.sh - run: ./apps/remix-ide/ci/publishIpfs - run: ./apps/remix-ide/ci/build_and_publish_docker_images.sh @@ -293,7 +293,7 @@ jobs: - checkout - run: npm install - run: npm run downloadsolc_assets - - run: npx nx build remix-ide --with-deps + - run: npm run build:production - run: name: Deploy command: | @@ -322,7 +322,7 @@ jobs: - run: npm install - run: npm run build:libs - run: npm run downloadsolc_assets - - run: npm run build + - run: npm run build:production - run: name: Deploy command: | diff --git a/apps/debugger/webpack.config.js b/apps/debugger/webpack.config.js index 7a97a4f3e0..02143af15b 100644 --- a/apps/debugger/webpack.config.js +++ b/apps/debugger/webpack.config.js @@ -3,18 +3,8 @@ const TerserPlugin = require('terser-webpack-plugin') module.exports = config => { const nxWebpackConfig = nxWebpack(config) - const productionConfig = process.env.NODE_ENV === 'production' ? { - mode: 'production', - devtool: 'source-map', - optimization: { - minimize: true, - minimizer: [new TerserPlugin()] - } - } : {} - - return { + const webpackConfig = { ...nxWebpackConfig, - ...productionConfig, node: { fs: 'empty', tls: 'empty', @@ -24,4 +14,18 @@ module.exports = config => { child_process: 'empty' } } + + if (process.env.NODE_ENV === 'production') { + return { + ...webpackConfig, + mode: 'production', + devtool: 'source-map', + optimization: { + minimize: true, + minimizer: [new TerserPlugin()] + } + } + } else { + return webpackConfig + } } diff --git a/apps/remix-ide/webpack.config.js b/apps/remix-ide/webpack.config.js index 7a97a4f3e0..02143af15b 100644 --- a/apps/remix-ide/webpack.config.js +++ b/apps/remix-ide/webpack.config.js @@ -3,18 +3,8 @@ const TerserPlugin = require('terser-webpack-plugin') module.exports = config => { const nxWebpackConfig = nxWebpack(config) - const productionConfig = process.env.NODE_ENV === 'production' ? { - mode: 'production', - devtool: 'source-map', - optimization: { - minimize: true, - minimizer: [new TerserPlugin()] - } - } : {} - - return { + const webpackConfig = { ...nxWebpackConfig, - ...productionConfig, node: { fs: 'empty', tls: 'empty', @@ -24,4 +14,18 @@ module.exports = config => { child_process: 'empty' } } + + if (process.env.NODE_ENV === 'production') { + return { + ...webpackConfig, + mode: 'production', + devtool: 'source-map', + optimization: { + minimize: true, + minimizer: [new TerserPlugin()] + } + } + } else { + return webpackConfig + } } diff --git a/package.json b/package.json index 37f244bcf4..3b86709188 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "downloadsolc_assets": "wget --no-check-certificate https://binaries.soliditylang.org/wasm/soljson-v0.8.7+commit.e28d00a7.js -O ./apps/remix-ide/src/assets/js/soljson.js", "make-mock-compiler": "node apps/remix-ide/ci/makeMockCompiler.js", "minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false", + "build:production": "NODE_ENV=production npx nx build remix-ide --with-deps", "nightwatch_parallel": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=chrome,firefox", "nightwatch_local_firefox": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=firefox", "nightwatch_local_chrome": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=chrome",