From 33ab7d27b7e5e237f1ae9279812808b12cd090c2 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Wed, 13 Apr 2022 20:48:57 +0200 Subject: [PATCH 01/13] refactor(webpack): use global require for checking hmr chunks --- .../src/loaders/nativescript-hot-loader/hmr.runtime.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts b/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts index 5434a0034..ecd96ef13 100644 --- a/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts +++ b/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts @@ -93,7 +93,7 @@ if (module.hot) { const requireExists = (path) => { try { - __non_webpack_require__(path); + global['require'](path); return true; } catch (err) { return false; @@ -112,7 +112,7 @@ if (module.hot) { logVerbose('LiveSync'); if (!hasUpdate()) { - return; + return false; } await checkAndApply(); From a6d19e9716d3a539b55b2a8d1fdf175d82a267e6 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Thu, 21 Apr 2022 23:40:38 +0200 Subject: [PATCH 02/13] wip: watchstate plugin adjustments --- .../webpack5/src/plugins/WatchStatePlugin.ts | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/webpack5/src/plugins/WatchStatePlugin.ts b/packages/webpack5/src/plugins/WatchStatePlugin.ts index 9adf2c6b0..81a8423f9 100644 --- a/packages/webpack5/src/plugins/WatchStatePlugin.ts +++ b/packages/webpack5/src/plugins/WatchStatePlugin.ts @@ -55,16 +55,24 @@ export class WatchStatePlugin { } // logic taken from CleanWebpackPlugin - const assets = - stats.toJson( - { - assets: true, - }, - true - ).assets || []; - const assetList = assets.map((asset) => asset.name); + // const assets = + // stats.toJson( + // { + // assets: true, + // }, + // true + // ).assets || []; + // const assetList = assets.map((asset) => asset.name); + // const emittedAssets = Array.from(compilation.emittedAssets); + + const assetList = Object.keys(compilation.assets); const emittedAssets = Array.from(compilation.emittedAssets); + + if (!prevAssets.length && emittedAssets.length < assetList.length) { + emittedAssets.push(...assetList); + } + const staleAssets = prevAssets.filter((asset) => { return assetList.includes(asset) === false; }); From 91d2c57ea0f392b0c90f04e713552d5e2c2c00ef Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 29 Apr 2022 17:50:12 +0200 Subject: [PATCH 03/13] feat(webpack): emit hrm boot status --- .../src/loaders/nativescript-hot-loader/hmr.runtime.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts b/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts index ecd96ef13..2f51c6a1a 100644 --- a/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts +++ b/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts @@ -19,7 +19,7 @@ if (module.hot) { const setStatus = ( hash: string, - status: 'success' | 'failure', + status: 'success' | 'failure' | 'boot', message?: string, ...info: any ): boolean => { @@ -116,6 +116,11 @@ if (module.hot) { } await checkAndApply(); - originalOnLiveSync(); + await originalOnLiveSync(); + + if (!global.hmrBootEmitted) { + global.hmrBootEmitted = true; + setStatus(hash, 'boot', 'HMR Enabled - waiting for changes...'); + } }; } From c450d0ad2af4267ec8bc28f3f6021876a572687d Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Mon, 30 May 2022 18:45:49 +0200 Subject: [PATCH 04/13] chore: bump deps --- packages/webpack5/package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/webpack5/package.json b/packages/webpack5/package.json index d813a25eb..f1846cced 100644 --- a/packages/webpack5/package.json +++ b/packages/webpack5/package.json @@ -29,17 +29,17 @@ "css": "^3.0.0", "css-loader": "^6.0.0", "dotenv-webpack": "^7.0.0", - "fork-ts-checker-webpack-plugin": "^6.0.0", - "loader-utils": "^2.0.0", + "fork-ts-checker-webpack-plugin": "^7.0.0", + "loader-utils": "^2.0.0 || ^3.0.0", "lodash.get": "^4.0.0", "micromatch": "^4.0.0", "postcss": "^8.0.0", "postcss-import": "^14.0.0", - "postcss-loader": "^6.0.0", + "postcss-loader": "^7.0.0", "raw-loader": "^4.0.0", "react-refresh": "~0.11.0", "sass": "^1.0.0", - "sass-loader": "^12.0.0", + "sass-loader": "^13.0.0", "sax": "^1.0.0", "source-map": "^0.7.0", "terser-webpack-plugin": "^5.0.0", @@ -56,17 +56,17 @@ "devDependencies": { "@angular-devkit/build-angular": "^13.1.2", "@types/css": "0.0.33", - "@types/jest": "27.0.1", + "@types/jest": "27.5.1", "@types/loader-utils": "2.0.3", - "@types/lodash.get": "4.4.6", + "@types/lodash.get": "4.4.7", "@types/micromatch": "4.0.2", - "@types/sax": "1.2.3", + "@types/sax": "1.2.4", "@types/terser-webpack-plugin": "5.2.0", "@types/webpack-virtual-modules": "0.1.1", - "jest": "27.1.1", - "jest-matcher-utils": "27.1.1", - "nativescript-vue-template-compiler": "2.9.0", - "ts-jest": "27.0.5", + "jest": "28.1.0", + "jest-matcher-utils": "28.1.0", + "nativescript-vue-template-compiler": "2.9.2", + "ts-jest": "28.0.3", "typescript": "4.7.3" }, "peerDependencies": { From 5a00438321ccd8720ee5aa9526ec67cd06fc0c99 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 7 Jun 2022 17:47:22 +0200 Subject: [PATCH 05/13] fix(hmr): emit boot log at boot instead of the 1st livesync --- .../nativescript-hot-loader/hmr.runtime.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts b/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts index 2f51c6a1a..b456a1fdc 100644 --- a/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts +++ b/packages/webpack5/src/loaders/nativescript-hot-loader/hmr.runtime.ts @@ -5,6 +5,7 @@ if (module.hot) { let hash = __webpack_require__.h(); + let hmrBootEmittedSymbol = Symbol.for('HMRBootEmitted'); const logVerbose = (title: string, ...info: any) => { if (__NS_ENV_VERBOSE__) { @@ -115,12 +116,15 @@ if (module.hot) { return false; } - await checkAndApply(); - await originalOnLiveSync(); - - if (!global.hmrBootEmitted) { - global.hmrBootEmitted = true; - setStatus(hash, 'boot', 'HMR Enabled - waiting for changes...'); + if (!(await checkAndApply())) { + return false; } + + await originalOnLiveSync(); }; + + if (!global[hmrBootEmittedSymbol]) { + global[hmrBootEmittedSymbol] = true; + setStatus(hash, 'boot', 'HMR Enabled - waiting for changes...'); + } } From 0556cf9b2088b5eb21a1787c1e822e53fa6f59bf Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Sun, 10 Jul 2022 11:34:23 +0200 Subject: [PATCH 07/13] refactor(webpack): use real modules and deprecate virtual modules --- .../__snapshots__/javascript.spec.ts.snap | 24 ++------------ .../__snapshots__/typescript.spec.ts.snap | 24 ++------------ .../configuration/typescript.spec.ts | 33 ++++++++++--------- .../webpack5/src/configuration/javascript.ts | 16 +++------ .../webpack5/src/configuration/typescript.ts | 16 +++------ .../webpack5/src/helpers/virtualModules.ts | 6 ++++ .../src/stubs/virtual-entry-javascript.js | 5 +++ .../src/stubs/virtual-entry-typescript.js | 5 +++ 8 files changed, 46 insertions(+), 83 deletions(-) create mode 100644 packages/webpack5/src/stubs/virtual-entry-javascript.js create mode 100644 packages/webpack5/src/stubs/virtual-entry-typescript.js diff --git a/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap b/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap index a72f3b8de..d52f8d5b1 100644 --- a/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap +++ b/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap @@ -302,16 +302,6 @@ exports[`javascript configuration for android 1`] = ` ), /* config.plugin('WatchStatePlugin') */ new WatchStatePlugin(), - /* config.plugin('ContextExclusionPlugin|__@nativescript_webpack_virtual_entry_javascript__') */ - new ContextExclusionPlugin( - /__@nativescript_webpack_virtual_entry_javascript__.js$/ - ), - /* config.plugin('VirtualModulesPlugin') */ - new VirtualModulesPlugin( - { - '__jest__/src/__@nativescript_webpack_virtual_entry_javascript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END' - } - ), /* config.plugin('ContextExclusionPlugin|exclude_files') */ new ContextExclusionPlugin( /\\\\b_.+\\\\./ @@ -320,7 +310,7 @@ exports[`javascript configuration for android 1`] = ` entry: { bundle: [ '@nativescript/core/globals/index', - '__jest__/src/__@nativescript_webpack_virtual_entry_javascript__', + '__jest__/node_modules/@nativescript/webpack/dist/stubs/virtual-entry-javascript', '@nativescript/core/bundle-entry-points', '__jest__/src/app.js', '@nativescript/core/ui/frame', @@ -632,16 +622,6 @@ exports[`javascript configuration for ios 1`] = ` ), /* config.plugin('WatchStatePlugin') */ new WatchStatePlugin(), - /* config.plugin('ContextExclusionPlugin|__@nativescript_webpack_virtual_entry_javascript__') */ - new ContextExclusionPlugin( - /__@nativescript_webpack_virtual_entry_javascript__.js$/ - ), - /* config.plugin('VirtualModulesPlugin') */ - new VirtualModulesPlugin( - { - '__jest__/src/__@nativescript_webpack_virtual_entry_javascript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);\\\\n// VIRTUAL ENTRY END' - } - ), /* config.plugin('ContextExclusionPlugin|exclude_files') */ new ContextExclusionPlugin( /\\\\b_.+\\\\./ @@ -650,7 +630,7 @@ exports[`javascript configuration for ios 1`] = ` entry: { bundle: [ '@nativescript/core/globals/index', - '__jest__/src/__@nativescript_webpack_virtual_entry_javascript__', + '__jest__/node_modules/@nativescript/webpack/dist/stubs/virtual-entry-javascript', '@nativescript/core/bundle-entry-points', '__jest__/src/app.js' ], diff --git a/packages/webpack5/__tests__/configuration/__snapshots__/typescript.spec.ts.snap b/packages/webpack5/__tests__/configuration/__snapshots__/typescript.spec.ts.snap index 5831fac29..39af4794d 100644 --- a/packages/webpack5/__tests__/configuration/__snapshots__/typescript.spec.ts.snap +++ b/packages/webpack5/__tests__/configuration/__snapshots__/typescript.spec.ts.snap @@ -302,16 +302,6 @@ exports[`typescript configuration for android 1`] = ` ), /* config.plugin('WatchStatePlugin') */ new WatchStatePlugin(), - /* config.plugin('ContextExclusionPlugin|__@nativescript_webpack_virtual_entry_typescript__') */ - new ContextExclusionPlugin( - /__@nativescript_webpack_virtual_entry_typescript__.js$/ - ), - /* config.plugin('VirtualModulesPlugin') */ - new VirtualModulesPlugin( - { - '__jest__/src/__@nativescript_webpack_virtual_entry_typescript__': '// VIRTUAL ENTRY START\\\\nrequire(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /\\\\\\\\.(xml|js|(? { }); } - it('filter typescript declaration files', () => { + it('filters typescript declaration files', () => { init({ ios: true, }); - const tsConfig = typescript(new Config()); + // const tsConfig = typescript(new Config()); let regex: RegExp; - // Get the filterRE from the typescript configuration - tsConfig.plugin('VirtualModulesPlugin').tap((args) => { - const options = args[0]; - const virtualConfig: string = options[Object.keys(options)[0]]; - const filterLine = virtualConfig - .split('\n') - .find((v) => v.includes('filter')); - const matches = filterLine.match(/\/(?\S+)\//); + const virtualEntryPath = path.join( + __dirname, + '../../src/stubs/virtual-entry-typescript.js' + ); + const virtualEntry = fs.readFileSync(virtualEntryPath); - if (matches) { - regex = new RegExp(matches.groups.filter); - } + const filterLine = virtualEntry + .toString() + .split('\n') + .find((v) => v.includes('filter')); - return args; - }); + const matches = filterLine.match(/\/(?\S+)\//); + + if (matches) { + regex = new RegExp(matches.groups.filter); + } expect(regex).toBeDefined(); diff --git a/packages/webpack5/src/configuration/javascript.ts b/packages/webpack5/src/configuration/javascript.ts index 914036eb2..d0af14695 100644 --- a/packages/webpack5/src/configuration/javascript.ts +++ b/packages/webpack5/src/configuration/javascript.ts @@ -1,26 +1,18 @@ import Config from 'webpack-chain'; import { getEntryPath, getEntryDirPath } from '../helpers/platform'; -import { addVirtualEntry } from '../helpers/virtualModules'; import { chainedSetAddAfter } from '../helpers/chain'; import { env as _env, IWebpackEnv } from '../index'; import { ContextExclusionPlugin } from 'webpack'; import base from './base'; +import path from 'path'; export default function (config: Config, env: IWebpackEnv = _env): Config { base(config, env); const entryPath = getEntryPath(); - const filterRE = '/.(xml|js|s?css)$/'; - const virtualEntryPath = addVirtualEntry( - config, - 'javascript', - ` - // VIRTUAL ENTRY START - require('@nativescript/core/bundle-entry-points') - const context = require.context("~/", /* deep: */ true, /* filter: */ ${filterRE}); - global.registerWebpackModules(context); - // VIRTUAL ENTRY END - ` + const virtualEntryPath = path.resolve( + __dirname, + '../stubs/virtual-entry-javascript' ); // exclude files starting with _ from require.context diff --git a/packages/webpack5/src/configuration/typescript.ts b/packages/webpack5/src/configuration/typescript.ts index 4513af52d..da0409319 100644 --- a/packages/webpack5/src/configuration/typescript.ts +++ b/packages/webpack5/src/configuration/typescript.ts @@ -1,26 +1,18 @@ import Config from 'webpack-chain'; import { getEntryDirPath, getEntryPath } from '../helpers/platform'; -import { addVirtualEntry } from '../helpers/virtualModules'; import { chainedSetAddAfter } from '../helpers/chain'; import { env as _env, IWebpackEnv } from '../index'; import { ContextExclusionPlugin } from 'webpack'; import base from './base'; +import path from 'path'; export default function (config: Config, env: IWebpackEnv = _env): Config { base(config, env); const entryPath = getEntryPath(); - const filterRE = '/\\.(xml|js|(? Date: Sun, 10 Jul 2022 11:35:11 +0200 Subject: [PATCH 08/13] feat(webpack): allow disabling nativescriptLibPath warning with a boolean --- packages/webpack5/src/helpers/config.ts | 20 +++++++++++++------- packages/webpack5/src/index.ts | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/webpack5/src/helpers/config.ts b/packages/webpack5/src/helpers/config.ts index 221d1feee..9c9281683 100644 --- a/packages/webpack5/src/helpers/config.ts +++ b/packages/webpack5/src/helpers/config.ts @@ -3,16 +3,22 @@ import { env } from '../index'; function getCLILib() { if (!env.nativescriptLibPath) { - warnOnce( - 'getCLILib', - ` - Cannot find NativeScript CLI path. Make sure --env.nativescriptLibPath is passed - ` - ); + if (typeof env.nativescriptLibPath !== 'boolean') { + warnOnce( + 'getCLILib', + ` + Cannot find NativeScript CLI path. Make sure --env.nativescriptLibPath is passed + ` + ); + } return false; } - return require(env.nativescriptLibPath); + if (typeof env.nativescriptLibPath === 'boolean') { + return false; + } + + return require(env.nativescriptLibPath as string); } /** diff --git a/packages/webpack5/src/index.ts b/packages/webpack5/src/index.ts index 39c2e1c8e..287029544 100644 --- a/packages/webpack5/src/index.ts +++ b/packages/webpack5/src/index.ts @@ -28,7 +28,7 @@ export interface IWebpackEnv { appResourcesPath?: string; appComponents?: string[]; - nativescriptLibPath?: string; + nativescriptLibPath?: string | boolean; android?: boolean; ios?: boolean; From eedc9c9eb1f07fa9c33a47149b80aa2f954dfb8b Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Sun, 10 Jul 2022 11:35:48 +0200 Subject: [PATCH 09/13] fix(webpack): remove copy rules that don't match any files to avoid false watch triggers --- packages/webpack5/src/helpers/copyRules.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/webpack5/src/helpers/copyRules.ts b/packages/webpack5/src/helpers/copyRules.ts index fe6dc932c..710e7ce4a 100644 --- a/packages/webpack5/src/helpers/copyRules.ts +++ b/packages/webpack5/src/helpers/copyRules.ts @@ -1,6 +1,7 @@ import CopyWebpackPlugin from 'copy-webpack-plugin'; import { basename, relative, resolve } from 'path'; import Config from 'webpack-chain'; +import { sync as globbySync } from 'globby'; import { getProjectRootPath } from './project'; import { getEntryDirPath } from './platform'; @@ -70,6 +71,15 @@ export function applyCopyRules(config: Config) { config.plugin('CopyWebpackPlugin').use(CopyWebpackPlugin, [ { patterns: Array.from(copyRules) + .filter((glob) => { + if (process.env.NODE_ENV === 'test') { + return true; + } + // remove rules that do not match any paths + // prevents webpack watch mode from firing + // due to "removed" paths. + return globbySync(glob).length > 0; + }) .map((glob) => ({ from: glob, context: entryDir, From e80ec0787351776ea345521bf3aa72d5cf28552d Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Sun, 10 Jul 2022 11:36:47 +0200 Subject: [PATCH 10/13] feat(webpack): add --env.stats to disable printing stats primarily used internally by preview-cli --- packages/webpack5/src/bin/index.ts | 19 +++++++++++-------- packages/webpack5/src/index.ts | 3 +++ .../webpack5/src/plugins/WatchStatePlugin.ts | 9 +++++---- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/webpack5/src/bin/index.ts b/packages/webpack5/src/bin/index.ts index 87ceed551..c9dddb315 100644 --- a/packages/webpack5/src/bin/index.ts +++ b/packages/webpack5/src/bin/index.ts @@ -56,6 +56,7 @@ program env['env'] = options.env; } + env['stats'] ??= true; env['watch'] ??= options.watch; // if --env.config is passed, we'll set an environment @@ -108,13 +109,15 @@ program // Set the process exit code depending on errors process.exitCode = stats.hasErrors() ? 1 : 0; - console.log( - stats.toString({ - chunks: false, - colors: true, - errorDetails: env.verbose, - }) - ); + if (env.stats) { + console.log( + stats.toString({ + chunks: false, + colors: true, + errorDetails: env.verbose, + }) + ); + } // if webpack profile is enabled we write the stats to a JSON file if (configuration.profile || env.profile) { @@ -141,7 +144,7 @@ program }; if (options.watch) { - console.log('webpack is watching the files...'); + env.stats && console.log('webpack is watching the files...'); compiler.watch( configuration.watchOptions ?? {}, webpackCompilationCallback diff --git a/packages/webpack5/src/index.ts b/packages/webpack5/src/index.ts index 287029544..058c74b68 100644 --- a/packages/webpack5/src/index.ts +++ b/packages/webpack5/src/index.ts @@ -46,6 +46,9 @@ export interface IWebpackEnv { // enable webpack profiling profile?: boolean; + // print webpack stats (default: true) + stats?: boolean; + // misc replace?: string[] | string; watchNodeModules?: boolean; diff --git a/packages/webpack5/src/plugins/WatchStatePlugin.ts b/packages/webpack5/src/plugins/WatchStatePlugin.ts index 81a8423f9..559f2e610 100644 --- a/packages/webpack5/src/plugins/WatchStatePlugin.ts +++ b/packages/webpack5/src/plugins/WatchStatePlugin.ts @@ -22,7 +22,7 @@ export class WatchStatePlugin { callback(); if (isWatchMode) { - console.log(messages.changeDetected); + env.stats && console.log(messages.changeDetected); if (env.verbose) { if (compiler.modifiedFiles) { @@ -44,9 +44,10 @@ export class WatchStatePlugin { compiler.hooks.afterEmit.tapAsync(id, function (compilation, callback) { callback(); - console.log( - isWatchMode ? messages.startWatching : messages.compilationComplete - ); + env.stats && + console.log( + isWatchMode ? messages.startWatching : messages.compilationComplete + ); // Do not notify the CLI if the compilation failed const stats = compilation.getStats(); From 851c43ff437997f003aa30ca029e871e72f20d16 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Sun, 10 Jul 2022 11:38:15 +0200 Subject: [PATCH 11/13] chore(release): @nativescript/webpack 5.0.8-alpha.2 --- packages/webpack5/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webpack5/package.json b/packages/webpack5/package.json index f1846cced..0a8d8ee3a 100644 --- a/packages/webpack5/package.json +++ b/packages/webpack5/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "5.0.7", + "version": "5.0.8-alpha.2", "private": false, "main": "dist/index.js", "files": [ From a96445f530361fc89a02960604da4128fe60e362 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 15 Jul 2022 19:32:56 +0200 Subject: [PATCH 12/13] fix: revert copy rule glob filter --- packages/webpack5/src/helpers/copyRules.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/webpack5/src/helpers/copyRules.ts b/packages/webpack5/src/helpers/copyRules.ts index 710e7ce4a..188443441 100644 --- a/packages/webpack5/src/helpers/copyRules.ts +++ b/packages/webpack5/src/helpers/copyRules.ts @@ -71,15 +71,17 @@ export function applyCopyRules(config: Config) { config.plugin('CopyWebpackPlugin').use(CopyWebpackPlugin, [ { patterns: Array.from(copyRules) - .filter((glob) => { - if (process.env.NODE_ENV === 'test') { - return true; - } - // remove rules that do not match any paths - // prevents webpack watch mode from firing - // due to "removed" paths. - return globbySync(glob).length > 0; - }) + // reverted: removes valid rules occasionally (ie fonts) + // todo: re-visit in future... + // .filter((glob) => { + // if (process.env.NODE_ENV === 'test') { + // return true; + // } + // // remove rules that do not match any paths + // // prevents webpack watch mode from firing + // // due to "removed" paths. + // return globbySync(glob).length > 0; + // }) .map((glob) => ({ from: glob, context: entryDir, From 9553afb0ad0e04a8886901c848c9e558397fb537 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 15 Jul 2022 19:38:12 +0200 Subject: [PATCH 13/13] chore(release): @nativescript/webpack 5.0.8-alpha.3 --- packages/webpack5/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webpack5/package.json b/packages/webpack5/package.json index 0a8d8ee3a..9d168dd33 100644 --- a/packages/webpack5/package.json +++ b/packages/webpack5/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "5.0.8-alpha.2", + "version": "5.0.8-alpha.3", "private": false, "main": "dist/index.js", "files": [