next-intlayer 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +199 -0
- package/dist/cjs/client/index.cjs +17 -23
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/client/index.d.ts +3 -10
- package/dist/cjs/client/useLocale.cjs +13 -20
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocale.d.ts +7 -7
- package/dist/cjs/generateStaticParams.cjs +8 -13
- package/dist/cjs/generateStaticParams.d.ts +2 -2
- package/dist/cjs/index.cjs +19 -25
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +8 -15
- package/dist/cjs/middleware/index.cjs +9 -21
- package/dist/cjs/middleware/index.d.ts +2 -2
- package/dist/cjs/middleware/intlayerMiddleware.cjs +28 -86
- package/dist/cjs/middleware/intlayerMiddleware.cjs.map +1 -1
- package/dist/cjs/middleware/intlayerMiddleware.d.ts +16 -1
- package/dist/cjs/middleware/localeDetector.cjs +20 -37
- package/dist/cjs/middleware/localeDetector.cjs.map +1 -1
- package/dist/cjs/middleware/localeDetector.d.ts +7 -2
- package/dist/cjs/server/index.cjs +17 -22
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/index.d.ts +3 -10
- package/dist/cjs/server/withIntlayer.cjs +38 -53
- package/dist/cjs/server/withIntlayer.cjs.map +1 -1
- package/dist/cjs/server/withIntlayer.d.ts +13 -5
- package/dist/cjs/types/NextPage.cjs +4 -8
- package/dist/cjs/types/NextPage.d.ts +6 -6
- package/dist/cjs/types/index.cjs +4 -8
- package/dist/cjs/types/index.d.ts +4 -4
- package/dist/esm/client/index.d.mts +3 -10
- package/dist/esm/client/index.mjs +8 -8
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/useLocale.d.mts +7 -7
- package/dist/esm/client/useLocale.mjs +12 -10
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/generateStaticParams.d.mts +2 -2
- package/dist/esm/generateStaticParams.mjs +4 -2
- package/dist/esm/index.d.mts +8 -15
- package/dist/esm/index.mjs +9 -9
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/middleware/index.d.mts +2 -2
- package/dist/esm/middleware/index.mjs +2 -2
- package/dist/esm/middleware/intlayerMiddleware.d.mts +16 -1
- package/dist/esm/middleware/intlayerMiddleware.mjs +21 -66
- package/dist/esm/middleware/intlayerMiddleware.mjs.map +1 -1
- package/dist/esm/middleware/localeDetector.d.mts +7 -2
- package/dist/esm/middleware/localeDetector.mjs +5 -3
- package/dist/esm/middleware/localeDetector.mjs.map +1 -1
- package/dist/esm/server/index.d.mts +3 -10
- package/dist/esm/server/index.mjs +8 -8
- package/dist/esm/server/index.mjs.map +1 -1
- package/dist/esm/server/withIntlayer.d.mts +13 -5
- package/dist/esm/server/withIntlayer.mjs +34 -37
- package/dist/esm/server/withIntlayer.mjs.map +1 -1
- package/dist/esm/types/NextPage.d.mts +6 -6
- package/dist/esm/types/NextPage.mjs +1 -1
- package/dist/esm/types/index.d.mts +4 -4
- package/dist/esm/types/index.mjs +1 -1
- package/package.json +14 -12
- package/src/client/index.ts +2 -2
- package/src/client/useLocale.ts +6 -4
- package/src/index.ts +2 -2
- package/src/middleware/intlayerMiddleware.ts +15 -0
- package/src/middleware/localeDetector.ts +5 -0
- package/src/server/index.ts +2 -2
- package/src/server/withIntlayer.ts +33 -27
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
import { resolve, relative, join } from "path";
|
|
2
2
|
import { getConfiguration, formatEnvVariable } from "@intlayer/config";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
Object.assign({},
|
|
11
|
-
|
|
3
|
+
import { IntLayerPlugin } from "@intlayer/webpack";
|
|
4
|
+
const withIntlayer = (_pluginOptions = {}) => (nextConfig = {}) => {
|
|
5
|
+
if (typeof nextConfig !== "object")
|
|
6
|
+
nextConfig = {};
|
|
7
|
+
const intlayerConfig = getConfiguration();
|
|
8
|
+
const env = formatEnvVariable("next");
|
|
9
|
+
const { mainDir, baseDir } = intlayerConfig.content;
|
|
10
|
+
return Object.assign({}, nextConfig, {
|
|
11
|
+
env: { ...nextConfig.env, ...env },
|
|
12
|
+
webpack: (config, { isServer, nextRuntime }) => {
|
|
13
|
+
const dictionariesPath = join(mainDir, "dictionaries.cjs");
|
|
14
|
+
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
15
|
+
config.resolve.alias["@intlayer/dictionaries-entry"] = resolve(
|
|
16
|
+
relativeDictionariesPath
|
|
17
|
+
);
|
|
18
|
+
config.externals.push({
|
|
19
|
+
esbuild: "esbuild",
|
|
20
|
+
module: "module",
|
|
21
|
+
fs: "fs"
|
|
22
|
+
});
|
|
23
|
+
config.module.rules.push({
|
|
24
|
+
test: /\.node$/,
|
|
25
|
+
loader: "node-loader"
|
|
26
|
+
});
|
|
27
|
+
if (isServer && nextRuntime === "nodejs") {
|
|
28
|
+
config.plugins.push(new IntLayerPlugin());
|
|
29
|
+
}
|
|
30
|
+
return config;
|
|
31
|
+
}
|
|
12
32
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
env: mergeEnvVariable(nextConfig.env),
|
|
19
|
-
stats: mergeStats(nextConfig.stats),
|
|
20
|
-
webpack: (config) => {
|
|
21
|
-
const dictionariesPath = join(mainDir, "dictionaries.cjs");
|
|
22
|
-
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
23
|
-
config.externals.push({
|
|
24
|
-
esbuild: "esbuild",
|
|
25
|
-
module: "module",
|
|
26
|
-
fs: "fs",
|
|
27
|
-
});
|
|
28
|
-
config.resolve.alias["@intlayer/dictionaries-entry"] = resolve(
|
|
29
|
-
relativeDictionariesPath
|
|
30
|
-
);
|
|
31
|
-
config.module.rules.push({
|
|
32
|
-
test: /\.node$/,
|
|
33
|
-
loader: "node-loader",
|
|
34
|
-
});
|
|
35
|
-
return config;
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
export { withIntlayer };
|
|
40
|
-
//# sourceMappingURL=withIntlayer.mjs.map
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
withIntlayer
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=withIntlayer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { resolve, relative, join } from 'path';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\n\ntype PluginOptions = {\n // TODO: add options\n};\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { resolve, relative, join } from 'path';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { IntLayerPlugin } from '@intlayer/webpack';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\n\ntype PluginOptions = {\n // TODO: add options\n};\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * // next.config.js\n * export default withIntlayer(nextConfig)\n *\n */\nexport const withIntlayer =\n (_pluginOptions: PluginOptions = {}) =>\n (nextConfig: Partial<NextConfig> = {}): Partial<NextConfig> => {\n if (typeof nextConfig !== 'object') nextConfig = {};\n\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('next');\n\n const { mainDir, baseDir } = intlayerConfig.content;\n\n return Object.assign({}, nextConfig, {\n env: { ...nextConfig.env, ...env },\n\n webpack: (\n config: WebpackParams['0'],\n { isServer, nextRuntime }: WebpackParams[1]\n ) => {\n const dictionariesPath = join(mainDir, 'dictionaries.cjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n config.resolve.alias['@intlayer/dictionaries-entry'] = resolve(\n relativeDictionariesPath\n );\n\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n });\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Apply IntLayerPlugin only on the server-side\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntLayerPlugin());\n }\n\n return config;\n },\n });\n };\n"],"mappings":"AAAA,SAAS,SAAS,UAAU,YAAY;AACxC,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,sBAAsB;AAoBxB,MAAM,eACX,CAAC,iBAAgC,CAAC,MAClC,CAAC,aAAkC,CAAC,MAA2B;AAC7D,MAAI,OAAO,eAAe;AAAU,iBAAa,CAAC;AAElD,QAAM,iBAAiB,iBAAiB;AAGxC,QAAM,MAAM,kBAAkB,MAAM;AAEpC,QAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAE5C,SAAO,OAAO,OAAO,CAAC,GAAG,YAAY;AAAA,IACnC,KAAK,EAAE,GAAG,WAAW,KAAK,GAAG,IAAI;AAAA,IAEjC,SAAS,CACP,QACA,EAAE,UAAU,YAAY,MACrB;AACH,YAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,YAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAEnE,aAAO,QAAQ,MAAM,8BAA8B,IAAI;AAAA,QACrD;AAAA,MACF;AAEA,aAAO,UAAU,KAAK;AAAA,QACpB,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,IAAI;AAAA,MACN,CAAC;AACD,aAAO,OAAO,MAAM,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AAGD,UAAI,YAAY,gBAAgB,UAAU;AACxC,eAAO,QAAQ,KAAK,IAAI,eAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Locales } from
|
|
2
|
-
import { NextPage } from
|
|
3
|
-
import { PropsWithChildren } from
|
|
1
|
+
import { Locales } from 'intlayer';
|
|
2
|
+
import { NextPage } from 'next';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
4
|
|
|
5
5
|
type LocalParams = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
params: {
|
|
7
|
+
locale: Locales;
|
|
8
|
+
};
|
|
9
9
|
};
|
|
10
10
|
type NextPageIntlayer = NextPage<LocalParams>;
|
|
11
11
|
type NextLayoutIntlayer = NextPage<PropsWithChildren<LocalParams>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
//# sourceMappingURL=NextPage.mjs.map
|
|
1
|
+
//# sourceMappingURL=NextPage.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { LocalParams, NextPageIntlayer } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
export { LocalParams, NextPageIntlayer } from './NextPage.mjs';
|
|
2
|
+
import 'intlayer';
|
|
3
|
+
import 'next';
|
|
4
|
+
import 'react';
|
package/dist/esm/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intlayer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Webpack configuration for IntLayer using NextJS",
|
|
6
6
|
"keywords": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"homepage": "https://github.com/aypineau/intlayer",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/aypineau/intlayer"
|
|
20
|
+
"url": "git+https://github.com/aypineau/intlayer.git"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"author": {
|
|
@@ -66,22 +66,24 @@
|
|
|
66
66
|
"negotiator": "^0.6.3",
|
|
67
67
|
"next": "14.1.4",
|
|
68
68
|
"webpack": "^5.91.0",
|
|
69
|
-
"@intlayer/
|
|
70
|
-
"@intlayer/config": "^1.
|
|
71
|
-
"intlayer": "^1.
|
|
72
|
-
"@intlayer/dictionaries-entry": "^1.
|
|
73
|
-
"
|
|
69
|
+
"@intlayer/chokidar": "^1.2.0",
|
|
70
|
+
"@intlayer/config": "^1.2.0",
|
|
71
|
+
"@intlayer/core": "^1.2.0",
|
|
72
|
+
"@intlayer/dictionaries-entry": "^1.2.0",
|
|
73
|
+
"@intlayer/webpack": "^1.2.0",
|
|
74
|
+
"intlayer": "^1.2.0",
|
|
75
|
+
"react-intlayer": "^1.2.0"
|
|
74
76
|
},
|
|
75
77
|
"devDependencies": {
|
|
76
78
|
"@types/negotiator": "^0.6.3",
|
|
77
|
-
"@types/node": "^20.
|
|
78
|
-
"@types/react": "^18.2.
|
|
79
|
+
"@types/node": "^20.12.7",
|
|
80
|
+
"@types/react": "^18.2.79",
|
|
79
81
|
"react": "^18.2.0",
|
|
80
82
|
"rimraf": "5.0.5",
|
|
81
83
|
"tsup": "^8.0.2",
|
|
82
|
-
"typescript": "^5.4.
|
|
83
|
-
"@utils/eslint-config": "^1.0.
|
|
84
|
-
"@utils/ts-config": "^1.0.
|
|
84
|
+
"typescript": "^5.4.5",
|
|
85
|
+
"@utils/eslint-config": "^1.0.1",
|
|
86
|
+
"@utils/ts-config": "^1.0.1"
|
|
85
87
|
},
|
|
86
88
|
"peerDependencies": {
|
|
87
89
|
"react": "^18.2.0"
|
package/src/client/index.ts
CHANGED
package/src/client/useLocale.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type Locales,
|
|
3
|
+
intlayerMiddlewareConfiguration,
|
|
4
|
+
} from '@intlayer/config/client';
|
|
3
5
|
import { usePathname, useRouter } from 'next/navigation.js';
|
|
4
6
|
import { useLocale as useReactLocale, useLocaleCookie } from 'react-intlayer';
|
|
5
7
|
|
|
@@ -18,7 +20,7 @@ export const useLocale = () => {
|
|
|
18
20
|
} = reactLocaleHook;
|
|
19
21
|
|
|
20
22
|
const setLocale = (locale: Locales) => {
|
|
21
|
-
if (currentLocale === locale) return;
|
|
23
|
+
if (currentLocale.toString() === locale.toString()) return;
|
|
22
24
|
|
|
23
25
|
if (!availableLocales.includes(locale)) {
|
|
24
26
|
console.error(`Locale ${locale} is not available`);
|
|
@@ -28,7 +30,7 @@ export const useLocale = () => {
|
|
|
28
30
|
setLocaleCookie(locale);
|
|
29
31
|
|
|
30
32
|
const pathWithoutLocale =
|
|
31
|
-
!prefixDefault && currentLocale === defaultLocale
|
|
33
|
+
!prefixDefault && currentLocale.toString() === defaultLocale.toString()
|
|
32
34
|
? pathname
|
|
33
35
|
: pathname.slice(`/${currentLocale}`.length) || '/';
|
|
34
36
|
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,21 @@ const {
|
|
|
13
13
|
noPrefix,
|
|
14
14
|
} = middleware;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Middleware that handles the internationalization layer
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
*
|
|
21
|
+
* // ./src/middleware.ts
|
|
22
|
+
*
|
|
23
|
+
* export { intlayerMiddleware as middleware } from '@intlayer/next/middleware';
|
|
24
|
+
*
|
|
25
|
+
* // applies this middleware only to files in the app directory
|
|
26
|
+
* export const config = {
|
|
27
|
+
* matcher: '/((?!api|static|.*\\..*|_next).*)',
|
|
28
|
+
* };
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
16
31
|
export const intlayerMiddleware = (request: NextRequest): NextResponse => {
|
|
17
32
|
const pathname = request.nextUrl.pathname;
|
|
18
33
|
const cookieLocale = getCookieLocale(request);
|
|
@@ -6,6 +6,11 @@ import type { NextRequest } from 'next/server.js';
|
|
|
6
6
|
|
|
7
7
|
const { locales, defaultLocale } = getConfiguration().internationalization;
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Detects the locale from the request headers
|
|
11
|
+
*
|
|
12
|
+
* Headers are provided by the browser and can be used to determine the user's preferred language
|
|
13
|
+
*/
|
|
9
14
|
export const localeDetector = (request: NextRequest): Locales => {
|
|
10
15
|
const negotiatorHeaders: Record<string, string> = {};
|
|
11
16
|
|
package/src/server/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolve, relative, join } from 'path';
|
|
2
2
|
import { getConfiguration, formatEnvVariable } from '@intlayer/config';
|
|
3
|
+
import { IntLayerPlugin } from '@intlayer/webpack';
|
|
3
4
|
import type { NextConfig } from 'next';
|
|
4
5
|
import type { NextJsWebpackConfig } from 'next/dist/server/config-shared';
|
|
5
6
|
|
|
@@ -7,54 +8,59 @@ type PluginOptions = {
|
|
|
7
8
|
// TODO: add options
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
verbose: true,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// Set all configuration values as environment variables
|
|
15
|
-
const env = formatEnvVariable('NEXT_PUBLIC_INTLAYER_');
|
|
16
|
-
const { mainDir, baseDir } = intlayerConfig.content;
|
|
17
|
-
|
|
18
|
-
const mergeEnvVariable = (
|
|
19
|
-
nextEnv: Record<string, unknown> | undefined = {}
|
|
20
|
-
): Record<string, string> => Object.assign({}, nextEnv, env);
|
|
21
|
-
|
|
22
|
-
const mergeStats = (
|
|
23
|
-
nextStats: Record<string, unknown> | undefined = {}
|
|
24
|
-
): Record<string, unknown> =>
|
|
25
|
-
Object.assign({}, nextStats, {
|
|
26
|
-
warnings: false,
|
|
27
|
-
});
|
|
11
|
+
type WebpackParams = Parameters<NextJsWebpackConfig>;
|
|
28
12
|
|
|
13
|
+
/**
|
|
14
|
+
* A Next.js plugin that adds the intlayer configuration to the webpack configuration
|
|
15
|
+
* and sets the environment variables
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
*
|
|
19
|
+
* // next.config.js
|
|
20
|
+
* export default withIntlayer(nextConfig)
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
29
23
|
export const withIntlayer =
|
|
30
24
|
(_pluginOptions: PluginOptions = {}) =>
|
|
31
25
|
(nextConfig: Partial<NextConfig> = {}): Partial<NextConfig> => {
|
|
32
26
|
if (typeof nextConfig !== 'object') nextConfig = {};
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
const intlayerConfig = getConfiguration();
|
|
29
|
+
|
|
30
|
+
// Set all configuration values as environment variables
|
|
31
|
+
const env = formatEnvVariable('next');
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
const { mainDir, baseDir } = intlayerConfig.content;
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
return Object.assign({}, nextConfig, {
|
|
36
|
+
env: { ...nextConfig.env, ...env },
|
|
37
|
+
|
|
38
|
+
webpack: (
|
|
39
|
+
config: WebpackParams['0'],
|
|
40
|
+
{ isServer, nextRuntime }: WebpackParams[1]
|
|
41
|
+
) => {
|
|
40
42
|
const dictionariesPath = join(mainDir, 'dictionaries.cjs');
|
|
41
43
|
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
42
44
|
|
|
45
|
+
config.resolve.alias['@intlayer/dictionaries-entry'] = resolve(
|
|
46
|
+
relativeDictionariesPath
|
|
47
|
+
);
|
|
48
|
+
|
|
43
49
|
config.externals.push({
|
|
44
50
|
esbuild: 'esbuild',
|
|
45
51
|
module: 'module',
|
|
46
52
|
fs: 'fs',
|
|
47
53
|
});
|
|
48
|
-
|
|
49
|
-
config.resolve.alias['@intlayer/dictionaries-entry'] = resolve(
|
|
50
|
-
relativeDictionariesPath
|
|
51
|
-
);
|
|
52
|
-
|
|
53
54
|
config.module.rules.push({
|
|
54
55
|
test: /\.node$/,
|
|
55
56
|
loader: 'node-loader',
|
|
56
57
|
});
|
|
57
58
|
|
|
59
|
+
// Apply IntLayerPlugin only on the server-side
|
|
60
|
+
if (isServer && nextRuntime === 'nodejs') {
|
|
61
|
+
config.plugins.push(new IntLayerPlugin());
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
return config;
|
|
59
65
|
},
|
|
60
66
|
});
|