From bcd65b9d21c5eee0769510bbadfc7c12f4e054cd Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Mon, 9 Sep 2024 16:46:41 +0200 Subject: [PATCH] chore: add build cmd --- app.config.environment.dev.js | 2 +- app.config.environment.prod.js | 35 ++++++++++++++++++++++++++++++++++ package.json | 3 +++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 app.config.environment.prod.js diff --git a/app.config.environment.dev.js b/app.config.environment.dev.js index 7264f18..9f5321e 100644 --- a/app.config.environment.dev.js +++ b/app.config.environment.dev.js @@ -22,7 +22,7 @@ const stackProvidedLibsConfig = { __DEVELOPMENT__: true, __STACK_ASSETS__: true, __PIWIK_TRACKER_URL__: JSON.stringify('https://statweb.grandlyon.com/'), - __PIWIK_SITEID__: 0 + __PIWIK_SITEID__: 201 }) ], module: { diff --git a/app.config.environment.prod.js b/app.config.environment.prod.js new file mode 100644 index 0000000..b65f3ee --- /dev/null +++ b/app.config.environment.prod.js @@ -0,0 +1,35 @@ +'use strict' + +const webpack = require('webpack') +const TerserPlugin = require('terser-webpack-plugin') + +const { target } = require('cozy-scripts/config/webpack.vars') + +module.exports = { + mode: 'production', + plugins: [ + // use a hash as chunk id to avoid id changes of not changing chunk + new webpack.HashedModuleIdsPlugin(), + new webpack.optimize.OccurrenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production'), // to compile on production mode (redux) + __IS_ALPHA__: false, + __DEVELOPMENT__: false, + __DEVTOOLS__: false, + __STACK_ASSETS__: target !== 'mobile', + __PIWIK_TRACKER_URL__: JSON.stringify('https://statweb.grandlyon.com/'), + __PIWIK_SITEID__: 201 + }) + ], + optimization: { + minimizer: [ + new TerserPlugin({ + parallel: true, + // To fix a SAfari 10 bug : https://github.com/zeit/next.js/issues/5630 + terserOptions: { + safari10: true + } + }) + ] + } +} diff --git a/package.json b/package.json index 57a363b..49aab62 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,10 @@ "prebuild": "yarn lint", "build": "yarn build:browser", "build:browser": "cs build --browser", + "build-dev": "yarn run build:css && yarn run build-dev:browser", + "build-dev:browser": "cs build --browser --config app.config.js", "build:mobile": "cs build --mobile", + "build:css": "sass -c ./src/styles:build", "watch": "yarn watch:browser", "watch:browser": "cs watch --browser", "watch:mobile": "cs watch --mobile", -- GitLab