diff --git a/app.config.environment.dev.js b/app.config.environment.dev.js index 7264f183895c8cdc51a8ec4769493453a281f2e7..9f5321eb8479434858df23a63a8d4a64517563c4 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 0000000000000000000000000000000000000000..b65f3ee47b6086a14e049437d4826932da36dcc0 --- /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 57a363bd6af9d66e3ec3db05bf3d9a799b3389d2..49aab628dd01fa53226a2acf47da68d6e80cbc86 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",