From 6f8a7f1d0d177207ab3ac5c6fcda1395db909023 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 8 Oct 2019 07:57:37 -0700 Subject: [PATCH] chore: disable esm/terser cache in travis (#1560) --- .travis.yml | 2 ++ webpack/client.config.js | 3 ++- webpack/server.config.js | 7 +++++++ webpack/service-worker.config.js | 9 +++++++-- webpack/terser.config.js | 4 ++-- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 85740db8..05ffe92a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,8 @@ after_script: script: travis_retry yarn run $COMMAND env: global: + - ESM_DISABLE_CACHE=1 # this cache causes travis to rebuild its cache every single time + - TERSER_DISABLE_CACHE=1 # ditto - secure: "iR11lD+OAyTJdNoK67esDOrd34HKQboJo0DrVL4xqwoAwQGmNX7posBtcj0TOwVAdHfd5S80xlhWlMebrtHWR9oMtdcBXusWnehZVRB0WE89n8enkJCbAxn5uMpcEpKpDHTcfR/Gbxf2sw15dTy0PrW/ldiZXWf7wybJEBGbrEP7QI8oy3VHzmKpSyjRpN/hnSlgxskVnfIMKPp43D+705Ka7aMJNTWZ5dAdKdIjQWX6j6jlqx6Vl+qIq7td3DTZA9A5ft8HxaWC27F1bbd52PdRY2h8Ii3Ps+n8Q8uZK1KJPp9t3pPk+PmYINu2715ArukRk73kahnFadBQLhytn95FLiyKOLj+ajBNo+o3KIQDs3qRj8gkXpkJpuLAPgwABOEVWuLh9y+oa33IDYVzyESRVtXqbbwgziYVjNQCozP1Nt9+Wyh4YHfdOjEEMdlVlkwlyzPfaLAqVBusEphnaF/vx7itdVvxOMQYNcSRoBrAgciN4ng0GZHi5P85DMXnNV41r+d3JK5JEYZD/gpSja5cPUlpPlkXsKiElG3fEoO2D/Uc8rR9Cu84XiJiJQjP91QuWagfdhgqM4YOndt2YukiGzRzDMjTx1BzSW4S11RQGWzZrv06zmDLXTlnUAMEm1/Exo4L6VfgRvyFmgM0LAT+IceVEHbOKC/Hnd8Y3mo=" - secure: "E9t4zTDdPX9I4XgeC5zJEy+mIM2s0MFPpNfJ/mc5q/JX+gQkHSNkE/32NKgfSce85v33kWWxiPK4qorgX4B+v/MkK6kVQ2HSC7p4XttlQucvSICh/hYSM21WnH7g7DRNj3mDWHWEAwQuquaxVLfGWL60M/svnKG9MOoewos9iDj9AvANm6J09DjRmLuqmDV+VL+cV6ZL/SvUZ5Ervkgs/s3nXHEMse9rKMH/6/KncTGGPRolqyx86XSU6/XtRKX2+bEdiOaIxUYYvjcHJZTKxpSelPpEHjoUfWCM2CG3WyjtYkLF/1Romh8Ft4pnz+iiTzN3eWaT2ralOFvW30oB3cKbDcFb6LDGfXYw7v+XIORc79Ehcb2XlweEymf7fPhbx+7bkCfudRCMLw6OUWXoh66BBjOh2gcQYQ2+3U8KV7YKl/ZQHYb722wE6rN0YvJ6zGriWomDuV1smdyu4teo4lY2oVUUUGflyz2HWxnjVbqWizw4k69TNIcEEQ8j8YgdXMUxNMUOJoCu0c3Lnd8J1BeU/7LX87c54/oCMjEivnsENGIC/EUgAoXDi3L0y7HzHgaDs112p5zjspJsSSON/T4E2uyyb2RpjBY4Ghl43a/RDAlv1gUFtvbanphg3PEGMfG7B2gxk9Z/v5J9pUP/NtsspmT2MvTHZXtH/44XPEU=" matrix: diff --git a/webpack/client.config.js b/webpack/client.config.js index 6eb53a36..0badbb41 100644 --- a/webpack/client.config.js +++ b/webpack/client.config.js @@ -86,9 +86,10 @@ module.exports = { setImmediate: false }, optimization: dev ? {} : { + minimize: !process.env.DEBUG, minimizer: [ terser() - ].filter(Boolean), + ], splitChunks: { chunks: 'async', minSize: 5000, diff --git a/webpack/server.config.js b/webpack/server.config.js index cba0dae0..e555c1bc 100644 --- a/webpack/server.config.js +++ b/webpack/server.config.js @@ -2,6 +2,7 @@ const webpack = require('webpack') const config = require('sapper/config/webpack.js') const pkg = require('../package.json') const { mode, dev, resolve, inlineSvgs, allSvgs } = require('./shared.config') +const terser = require('./terser.config') // modules that the server should ignore, either because they cause errors or warnings // (because they're only used on the client side) @@ -47,6 +48,12 @@ module.exports = { performance: { hints: false // it doesn't matter if server.js is large }, + optimization: dev ? {} : { + minimize: !process.env.DEBUG, + minimizer: [ + terser() + ] + }, plugins: [ new webpack.DefinePlugin({ 'process.env.INLINE_SVGS': JSON.stringify(inlineSvgs), diff --git a/webpack/service-worker.config.js b/webpack/service-worker.config.js index ba18484f..cf9ad728 100644 --- a/webpack/service-worker.config.js +++ b/webpack/service-worker.config.js @@ -15,13 +15,18 @@ module.exports = { process.env.LEGACY && legacyBabel() ].filter(Boolean) }, + optimization: dev ? {} : { + minimize: !process.env.DEBUG, + minimizer: [ + terser() + ] + }, plugins: [ new webpack.DefinePlugin({ 'process.browser': true, 'process.env.NODE_ENV': JSON.stringify(mode), 'process.env.LEGACY': !!process.env.LEGACY, 'process.env.SAPPER_TIMESTAMP': process.env.SAPPER_TIMESTAMP || Date.now() - }), - terser() + }) ].filter(Boolean) } diff --git a/webpack/terser.config.js b/webpack/terser.config.js index 3d8eb5db..d8ec091f 100644 --- a/webpack/terser.config.js +++ b/webpack/terser.config.js @@ -1,8 +1,8 @@ const TerserWebpackPlugin = require('terser-webpack-plugin') -module.exports = () => !process.env.DEBUG && new TerserWebpackPlugin({ +module.exports = () => new TerserWebpackPlugin({ exclude: /tesseract-asset/, - cache: true, + cache: !process.env.TERSER_DISABLE_CACHE, parallel: true, sourceMap: true, terserOptions: {