From aec21dbc039618526331acba6ccd805ef47a3d5c Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Tue, 1 Dec 2020 21:14:56 -0600 Subject: [PATCH 1/4] refactor: sw-debug is now no longer copied to prod builds --- .../cli/lib/lib/webpack/webpack-client-config.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/cli/lib/lib/webpack/webpack-client-config.js b/packages/cli/lib/lib/webpack/webpack-client-config.js index 2add797cf..fbc70e591 100644 --- a/packages/cli/lib/lib/webpack/webpack-client-config.js +++ b/packages/cli/lib/lib/webpack/webpack-client-config.js @@ -92,7 +92,7 @@ async function clientConfig(env) { // copy any static files existsSync(source('assets')) && { from: 'assets', to: 'assets' }, // copy sw-debug - { + !isProd && { from: resolve(__dirname, '../../resources/sw-debug.js'), to: 'sw-debug.js', }, @@ -120,13 +120,9 @@ function getBabelEsmPlugin(config) { beforeStartExecution: (plugins, newConfig) => { const babelPlugins = newConfig.plugins; newConfig.plugins = babelPlugins.filter(plugin => { - if ( - Array.isArray(plugin) && - plugin[0].indexOf('fast-async') !== -1 - ) { - return false; - } - return true; + return !( + Array.isArray(plugin) && plugin[0].indexOf('fast-async') !== -1 + ); }); plugins.forEach(plugin => { if ( From 98bd6897b0a2467bddf7d6684fffd209a7860619 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Tue, 1 Dec 2020 21:18:52 -0600 Subject: [PATCH 2/4] docs: Adding changeset --- .changeset/fair-ants-deny.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fair-ants-deny.md diff --git a/.changeset/fair-ants-deny.md b/.changeset/fair-ants-deny.md new file mode 100644 index 000000000..de9402ebd --- /dev/null +++ b/.changeset/fair-ants-deny.md @@ -0,0 +1,5 @@ +--- +'preact-cli': patch +--- + +No longer copies 'sw-debug.js' to output directory on prod builds. No functional changes, as it was not used. From d0449ce4e5b93c20a87d787388d547d765fb45f6 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Tue, 1 Dec 2020 21:38:11 -0600 Subject: [PATCH 3/4] test: Updating test suite to not expect sw-debug in prod --- packages/cli/tests/images/build.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/cli/tests/images/build.js b/packages/cli/tests/images/build.js index 0d6f311f7..afd1fcb91 100644 --- a/packages/cli/tests/images/build.js +++ b/packages/cli/tests/images/build.js @@ -30,7 +30,6 @@ exports.default = exports.full = Object.assign({}, common, { 'ssr-build/ssr-bundle.6e806.css.map': 1250, 'ssr-build/ssr-bundle.js': 9976, 'ssr-build/ssr-bundle.js.map': 30887, - 'sw-debug.js': 775, }); exports['default-esm'] = exports.full = Object.assign({}, exports.default, { 'bundle.*.esm.js': 21135, From 3804d07e3a19b354fcb6ce3e34c80e24820e1743 Mon Sep 17 00:00:00 2001 From: Ryan Christian <33403762+rschristian@users.noreply.github.com> Date: Wed, 2 Dec 2020 11:05:41 -0600 Subject: [PATCH 4/4] revert: Code style change --- packages/cli/lib/lib/webpack/webpack-client-config.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/cli/lib/lib/webpack/webpack-client-config.js b/packages/cli/lib/lib/webpack/webpack-client-config.js index fbc70e591..a390d3bf7 100644 --- a/packages/cli/lib/lib/webpack/webpack-client-config.js +++ b/packages/cli/lib/lib/webpack/webpack-client-config.js @@ -120,9 +120,13 @@ function getBabelEsmPlugin(config) { beforeStartExecution: (plugins, newConfig) => { const babelPlugins = newConfig.plugins; newConfig.plugins = babelPlugins.filter(plugin => { - return !( - Array.isArray(plugin) && plugin[0].indexOf('fast-async') !== -1 - ); + if ( + Array.isArray(plugin) && + plugin[0].indexOf('fast-async') !== -1 + ) { + return false; + } + return true; }); plugins.forEach(plugin => { if (