From a60bd422cc426de62147334a8ec88f02b49798fd Mon Sep 17 00:00:00 2001 From: Alex Hixon Date: Tue, 8 Oct 2024 13:06:07 -0700 Subject: [PATCH] run the transformer as long as we're non-prod This change means that we will now run the transformer if Parcel was run with a custom environment. We now also exclude CSS files, since they might have a React dependency but they're not script files. --- .../react-refresh-wrap/src/ReactRefreshWrapTransformer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/transformers/react-refresh-wrap/src/ReactRefreshWrapTransformer.js b/packages/transformers/react-refresh-wrap/src/ReactRefreshWrapTransformer.js index b0df28bd206..de8708e8f5f 100644 --- a/packages/transformers/react-refresh-wrap/src/ReactRefreshWrapTransformer.js +++ b/packages/transformers/react-refresh-wrap/src/ReactRefreshWrapTransformer.js @@ -6,12 +6,13 @@ import {Transformer} from '@parcel/plugin'; function shouldExclude(asset, options) { return ( !asset.isSource || + !asset.type === 'css' || !options.hmrOptions || !asset.env.isBrowser() || asset.env.isLibrary || asset.env.isWorker() || asset.env.isWorklet() || - options.mode !== 'development' || + options.mode === 'production' || !asset .getDependencies() .find(