Skip to content

Commit 70c58ec

Browse files
committed
refactor(next-intlayer): change getIsSwcPluginAvailable from autoexecute function to classic function
1 parent 47b3db2 commit 70c58ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/next-intlayer/src/server/withIntlayer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ const isGteNext15 = compareVersions(nextVersion, '≥', '15.0.0');
2020
const isTurbopackStable = compareVersions(nextVersion, '≥', '15.3.0');
2121

2222
// Check if SWC plugin is available
23-
const isSwcPluginAvailable = (() => {
23+
const getIsSwcPluginAvailable = () => {
2424
try {
2525
ESMxCJSRequire.resolve('@intlayer/swc');
2626
return true;
2727
} catch (e) {
2828
return false;
2929
}
30-
})();
30+
};
3131

3232
const getPruneConfig = (
3333
intlayerConfig: IntlayerConfig
@@ -40,6 +40,7 @@ const getPruneConfig = (
4040

4141
if (!isGteNext13) return {};
4242

43+
const isSwcPluginAvailable = getIsSwcPluginAvailable();
4344
if (!isSwcPluginAvailable) return {};
4445

4546
const dictionariesPath = join(mainDir, 'dictionaries.mjs');

0 commit comments

Comments
 (0)