@centreon/js-config 24.8.2 → 24.9.1

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.
Files changed (33) hide show
  1. package/cypress/component/commands.tsx +22 -82
  2. package/cypress/component/configuration.js +16 -39
  3. package/cypress/component/enableVisualTesting.ts +1 -1
  4. package/cypress/e2e/commands/configuration.ts +1 -330
  5. package/cypress/e2e/commands.ts +149 -629
  6. package/cypress/e2e/configuration.ts +40 -46
  7. package/cypress/e2e/plugins.ts +114 -52
  8. package/eslint/base.typescript.eslintrc.js +3 -15
  9. package/jest/index.js +2 -5
  10. package/package.json +45 -57
  11. package/tsconfig/index.json +4 -5
  12. package/webpack/base/index.js +130 -0
  13. package/webpack/patch/dev.js +24 -0
  14. package/{rspack → webpack}/patch/devServer.js +5 -3
  15. package/webpack/patch/module.js +46 -0
  16. package/biome/base.json +0 -224
  17. package/cypress/component/disableCssTransitions.ts +0 -19
  18. package/cypress/component/excludeNodeModulesFromCoverage.js +0 -36
  19. package/cypress/e2e/commands/monitoring.ts +0 -117
  20. package/cypress/e2e/esbuild-preprocessor.ts +0 -26
  21. package/cypress/e2e/reporter-config.js +0 -13
  22. package/cypress/e2e/tasks.ts +0 -259
  23. package/eslint/lambda/typescript.eslintrc.js +0 -48
  24. package/jest/lambda/typescript.js +0 -49
  25. package/rspack/base/globalConfig.js +0 -71
  26. package/rspack/base/index.js +0 -89
  27. package/rspack/patch/dev.js +0 -12
  28. package/rspack/patch/module.js +0 -13
  29. package/rspack/plugins/TransformPreloadScript.js +0 -37
  30. package/rspack/plugins/WriteRemoteEntryNameToModuleFederation.js +0 -30
  31. package/tsconfig/lambda/node20.tsconfig.json +0 -12
  32. package/tsconfig/lambda/tsconfig.json +0 -14
  33. package/tsconfig.json +0 -21
@@ -1,21 +1,16 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
1
  /* eslint-disable import/extensions */
3
2
  /* eslint-disable import/no-unresolved */
4
3
 
5
4
  import { execSync } from 'child_process';
6
5
 
7
6
  import { defineConfig } from 'cypress';
8
- import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter';
9
- import { config as configDotenv } from 'dotenv';
10
7
 
11
- import esbuildPreprocessor from './esbuild-preprocessor';
12
- import plugins from './plugins';
13
- import tasks from './tasks';
8
+ import setupNodeEvents from './plugins';
14
9
 
15
10
  interface ConfigurationOptions {
16
11
  cypressFolder?: string;
12
+ dockerName?: string;
17
13
  env?: Record<string, unknown>;
18
- envFile?: string;
19
14
  isDevelopment?: boolean;
20
15
  specPattern: string;
21
16
  }
@@ -24,14 +19,12 @@ export default ({
24
19
  specPattern,
25
20
  cypressFolder,
26
21
  isDevelopment,
27
- env,
28
- envFile
22
+ dockerName,
23
+ env
29
24
  }: ConfigurationOptions): Cypress.ConfigOptions => {
30
- if (envFile) {
31
- configDotenv({ path: envFile });
32
- }
33
-
34
- const resultsFolder = `${cypressFolder || '.'}/results`;
25
+ const resultsFolder = `${cypressFolder || 'cypress'}/results${
26
+ isDevelopment ? '/dev' : ''
27
+ }`;
35
28
 
36
29
  const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
37
30
  .toString('utf8')
@@ -39,46 +32,47 @@ export default ({
39
32
 
40
33
  return defineConfig({
41
34
  chromeWebSecurity: false,
42
- defaultCommandTimeout: 20000,
43
- downloadsFolder: `${resultsFolder}/downloads`,
35
+ defaultCommandTimeout: 6000,
44
36
  e2e: {
45
37
  excludeSpecPattern: ['*.js', '*.ts', '*.md'],
46
- fixturesFolder: 'fixtures',
47
- reporter: require.resolve('cypress-multi-reporters'),
48
- reporterOptions: {
49
- configFile: `${__dirname}/reporter-config.js`
50
- },
51
- setupNodeEvents: async (cypressOn, config) => {
52
- const on = require('cypress-on-fix')(cypressOn)
53
- installLogsPrinter(on);
54
- await esbuildPreprocessor(on, config);
55
- tasks(on);
56
-
57
- return plugins(on, config);
58
- },
59
- specPattern,
60
- supportFile: 'support/e2e.{js,jsx,ts,tsx}'
38
+ setupNodeEvents,
39
+ specPattern
61
40
  },
62
41
  env: {
63
42
  ...env,
64
- DATABASE_IMAGE: 'bitnami/mariadb:10.11',
65
- OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
66
- SAML_IMAGE_VERSION: process.env.MAJOR || '24.04',
67
- STABILITY: 'unstable',
43
+ OPENID_IMAGE_VERSION: '23.04',
68
44
  WEB_IMAGE_OS: 'alma9',
69
- WEB_IMAGE_VERSION: webImageVersion
45
+ WEB_IMAGE_VERSION: webImageVersion,
46
+ dockerName: dockerName || 'centreon-dev'
70
47
  },
71
- execTimeout: 60000,
72
- requestTimeout: 20000,
73
- retries: {
74
- openMode: 0,
75
- runMode: 2
48
+ execTimeout: 120000,
49
+ reporter: 'mochawesome',
50
+ reporterOptions: {
51
+ html: false,
52
+ json: true,
53
+ overwrite: true,
54
+ reportDir: `${resultsFolder}/reports`,
55
+ reportFilename: '[name]-report.json'
76
56
  },
57
+ requestTimeout: 10000,
58
+ retries: 0,
77
59
  screenshotsFolder: `${resultsFolder}/screenshots`,
78
- video: isDevelopment,
79
- videoCompression: 0,
80
- videosFolder: `${resultsFolder}/videos`,
81
- viewportHeight: 1080,
82
- viewportWidth: 1920
60
+ setupNodeEvents: (on, config) => {
61
+ on('before:browser:launch', (browser, launchOptions) => {
62
+ if (browser.name === 'chrome' && browser.isHeadless) {
63
+ launchOptions.args = launchOptions.args.map((arg) => {
64
+ if (arg === '--headless') {
65
+ return '--headless=new';
66
+ }
67
+
68
+ return arg;
69
+ });
70
+ }
71
+
72
+ return launchOptions;
73
+ });
74
+ },
75
+ video: true,
76
+ videosFolder: `${resultsFolder}/videos`
83
77
  });
84
78
  };
@@ -3,68 +3,130 @@
3
3
  /* eslint-disable @typescript-eslint/no-var-requires */
4
4
  /* eslint-disable no-param-reassign */
5
5
 
6
- import fs from 'fs';
7
- import path from 'path';
8
-
9
- export default (
10
- on: Cypress.PluginEvents,
11
- config: Cypress.PluginConfigOptions
12
- ): Cypress.PluginConfigOptions => {
13
- on('before:browser:launch', (browser, launchOptions) => {
14
- const width = 1920;
15
- const height = 1080;
16
-
17
- if (browser.family === 'chromium' && browser.name !== 'electron') {
18
- if (browser.isHeadless) {
19
- launchOptions.args.push('--headless=new');
20
- }
6
+ import Docker from 'dockerode';
7
+ import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
8
+ import webpackPreprocessor from '@cypress/webpack-preprocessor';
21
9
 
22
- // flags description : https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
23
- launchOptions.args.push('--disable-gpu');
24
- launchOptions.args.push('--auto-open-devtools-for-tabs');
25
- launchOptions.args.push('--disable-extensions');
26
- launchOptions.args.push('--hide-scrollbars');
27
- launchOptions.args.push('--mute-audio');
10
+ const docker = new Docker();
11
+
12
+ const getWebpackOptions = (config): object => {
13
+ return {
14
+ module: {
15
+ rules: [
16
+ {
17
+ exclude: [/node_modules/],
18
+ test: /\.ts?$/,
19
+ use: [
20
+ {
21
+ loader: 'swc-loader'
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ test: /\.feature$/,
27
+ use: [
28
+ {
29
+ loader: '@badeball/cypress-cucumber-preprocessor/webpack',
30
+ options: config
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ },
36
+ resolve: {
37
+ extensions: ['.ts', '.js']
38
+ }
39
+ };
40
+ };
28
41
 
29
- // force screen to be non-retina and just use our given resolution
30
- launchOptions.args.push('--force-device-scale-factor=1');
42
+ export default async (on, config): Promise<void> => {
43
+ await addCucumberPreprocessorPlugin(on, config);
31
44
 
32
- launchOptions.args.push(`--window-size=${width},${height}`);
45
+ const webpackOptions = await getWebpackOptions(config);
46
+ const options = {
47
+ webpackOptions
48
+ };
49
+
50
+ on('file:preprocessor', webpackPreprocessor(options));
51
+
52
+ on('before:browser:launch', (browser = {}, launchOptions) => {
53
+ if ((browser as { name }).name === 'chrome') {
54
+ launchOptions.args.push('--disable-gpu');
55
+ launchOptions.args = launchOptions.args.filter(
56
+ (element) => element !== '--disable-dev-shm-usage'
57
+ );
33
58
  }
34
59
 
35
60
  return launchOptions;
36
61
  });
37
62
 
38
- on('after:run', (results) => {
39
- const testRetries: { [key: string]: boolean } = {};
40
- if ('runs' in results) {
41
- results.runs.forEach((run) => {
42
- run.tests.forEach((test) => {
43
- if (test.attempts && test.attempts.length > 1) {
44
- const testTitle = test.title.join(' > '); // Convert the array to a string
45
- testRetries[testTitle] = true;
46
- }
47
- });
63
+ interface PortBinding {
64
+ destination: number;
65
+ source: number;
66
+ }
67
+
68
+ interface StartContainerProps {
69
+ image: string;
70
+ name: string;
71
+ portBindings: Array<PortBinding>;
72
+ }
73
+
74
+ interface StopContainerProps {
75
+ name: string;
76
+ }
77
+
78
+ on('task', {
79
+ startContainer: async ({
80
+ image,
81
+ name,
82
+ portBindings = []
83
+ }: StartContainerProps) => {
84
+ const webContainers = await docker.listContainers({
85
+ all: true,
86
+ filters: { name: [name] }
48
87
  });
49
- }
88
+ if (webContainers.length) {
89
+ return webContainers[0];
90
+ }
91
+
92
+ const container = await docker.createContainer({
93
+ AttachStderr: true,
94
+ AttachStdin: false,
95
+ AttachStdout: true,
96
+ ExposedPorts: portBindings.reduce((accumulator, currentValue) => {
97
+ accumulator[`${currentValue.source}/tcp`] = {};
98
+
99
+ return accumulator;
100
+ }, {}),
101
+ HostConfig: {
102
+ PortBindings: portBindings.reduce((accumulator, currentValue) => {
103
+ accumulator[`${currentValue.source}/tcp`] = [
104
+ {
105
+ HostIP: '0.0.0.0',
106
+ HostPort: `${currentValue.destination}`
107
+ }
108
+ ];
109
+
110
+ return accumulator;
111
+ }, {})
112
+ },
113
+ Image: image,
114
+ OpenStdin: false,
115
+ StdinOnce: false,
116
+ Tty: true,
117
+ name
118
+ });
119
+
120
+ await container.start();
121
+
122
+ return container;
123
+ },
124
+ stopContainer: async ({ name }: StopContainerProps) => {
125
+ const container = await docker.getContainer(name);
126
+ await container.kill();
127
+ await container.remove();
50
128
 
51
- console.log('After run results:', results);
52
- console.log('Test retries:', testRetries);
53
-
54
- // Save the testRetries object to a file in the e2e/results directory
55
- const resultFilePath = path.join(
56
- __dirname,
57
- '../../../../tests/e2e/results',
58
- 'hasRetries.json'
59
- );
60
- if (results.totalFailed > 0) {
61
- fs.writeFileSync(resultFilePath, '{}');
62
- } else if (Object.keys(testRetries).length > 0) {
63
- // If tests succeeded but there were retries, write the retries to the file
64
- fs.writeFileSync(resultFilePath, JSON.stringify(testRetries, null, 2));
65
- } else {
66
- // If no retries, empty the file
67
- fs.writeFileSync(resultFilePath, '{}');
129
+ return null;
68
130
  }
69
131
  });
70
132
 
@@ -21,15 +21,11 @@ module.exports = {
21
21
  }
22
22
  ],
23
23
  '@typescript-eslint/camelcase': 'off',
24
- '@typescript-eslint/consistent-type-definitions': ['off', 'interface'],
25
- '@typescript-eslint/explicit-function-return-type': [
24
+ '@typescript-eslint/consistent-type-definitions': [
26
25
  'error',
27
- {
28
- allowExpressions: true,
29
- allowHigherOrderFunctions: true,
30
- allowTypedFunctionExpressions: true
31
- }
26
+ 'interface'
32
27
  ],
28
+ '@typescript-eslint/explicit-function-return-type': ['error'],
33
29
  '@typescript-eslint/explicit-member-accessibility': [
34
30
  'error',
35
31
  {
@@ -80,21 +76,13 @@ module.exports = {
80
76
  }
81
77
  ],
82
78
  camelcase: 'off',
83
- 'import/no-cycle': 'off',
84
- 'import/no-named-as-default': 'warn',
85
79
  'no-shadow': 'off',
86
80
  'no-unused-expressions': 'off'
87
81
  },
88
82
  settings: {
89
- 'import/parsers': {
90
- '@typescript-eslint/parser': ['.ts', '.tsx']
91
- },
92
83
  'import/resolver': {
93
84
  alias: {
94
85
  extensions: ['.ts', '.tsx', '.js', '.jsx']
95
- },
96
- typescript: {
97
- alwaysTryTypes: true
98
86
  }
99
87
  }
100
88
  }
package/jest/index.js CHANGED
@@ -1,15 +1,12 @@
1
1
  module.exports = {
2
2
  moduleNameMapper: {
3
3
  '\\.(s?css|png|svg|jpg)$': 'identity-obj-proxy',
4
- '^.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
5
- 'jest-transform-stub',
6
4
  '^react($|/.+)': '<rootDir>/node_modules/react$1'
7
5
  },
6
+ setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
8
7
  testEnvironment: 'jsdom',
9
- testPathIgnorePatterns: ['/node_modules/', '!*.cypress.spec.tsx'],
8
+ testPathIgnorePatterns: ['/node_modules/'],
10
9
  transform: {
11
- '.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
12
- 'jest-transform-stub',
13
10
  '^.+\\.[jt]sx?$': [
14
11
  '@swc/jest',
15
12
  {
package/package.json CHANGED
@@ -1,59 +1,47 @@
1
1
  {
2
- "name": "@centreon/js-config",
3
- "description": "Centreon Frontend shared build configuration",
4
- "version": "24.8.2",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/centreon/centreon-frontend.git"
8
- },
9
- "keywords": [
10
- "centreon",
11
- "eslint"
12
- ],
13
- "author": "centreon@centreon.com",
14
- "license": "MIT",
15
- "bugs": {
16
- "url": "https://github.com/centreon/centreon-frontend/issues"
17
- },
18
- "homepage": "https://github.com/centreon/centreon-frontend#readme",
19
- "peerDependencies": {
20
- "eslint": "^8.53.0",
21
- "prettier": "^3.0.0"
22
- },
23
- "dependencies": {
24
- "@badeball/cypress-cucumber-preprocessor": "^20.1.2",
25
- "@bahmutov/cypress-esbuild-preprocessor": "^2.2.2",
26
- "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
27
- "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
28
- "@tsconfig/node16": "^16.1.3",
29
- "@tsconfig/node20": "^20.1.4",
30
- "@types/cypress-cucumber-preprocessor": "^4.0.5",
31
- "cypress": "^13.13.3",
32
- "cypress-multi-reporters": "^1.6.4",
33
- "cypress-terminal-report": "^6.1.2",
34
- "cypress-wait-until": "^3.0.2",
35
- "dotenv": "^16.4.5",
36
- "esbuild": "^0.21.5",
37
- "eslint": "^8.53.0",
38
- "eslint-config-airbnb": "19.0.4",
39
- "eslint-config-prettier": "^8.5.0",
40
- "eslint-import-resolver-alias": "^1.1.2",
41
- "eslint-import-resolver-typescript": "^3.5.5",
42
- "eslint-plugin-babel": "^5.3.1",
43
- "eslint-plugin-hooks": "^0.4.3",
44
- "eslint-plugin-import": "^2.26.0",
45
- "eslint-plugin-jest": "^26.1.5",
46
- "eslint-plugin-jsx-a11y": "^6.5.1",
47
- "eslint-plugin-node": "^11.1.0",
48
- "eslint-plugin-prefer-arrow-functions": "^3.1.4",
49
- "eslint-plugin-prettier": "^5.0.0",
50
- "eslint-plugin-react": "^7.29.4",
51
- "eslint-plugin-react-hooks": "^4.5.0",
52
- "eslint-plugin-sort-keys-fix": "^1.1.2",
53
- "eslint-plugin-typescript-sort-keys": "^2.1.0",
54
- "mochawesome": "^7.1.3",
55
- "mysql2": "^3.11.0",
56
- "tar-fs": "^3.0.6",
57
- "testcontainers": "^10.11.0"
58
- }
2
+ "name": "@centreon/js-config",
3
+ "description": "Centreon Frontend shared build configuration",
4
+ "version": "24.9.1",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/centreon/centreon-frontend.git"
8
+ },
9
+ "keywords": [
10
+ "centreon",
11
+ "eslint"
12
+ ],
13
+ "author": "centreon@centreon.com",
14
+ "license": "GPL-2.0",
15
+ "bugs": {
16
+ "url": "https://github.com/centreon/centreon-frontend/issues"
17
+ },
18
+ "devDependencies": {
19
+ "@badeball/cypress-cucumber-preprocessor": "^14.0.0",
20
+ "@types/dockerode": "^3.3.16",
21
+ "dockerode": "^3.3.5",
22
+ "eslint": "^8.17.0",
23
+ "eslint-config-airbnb": "19.0.4",
24
+ "eslint-config-prettier": "^8.5.0",
25
+ "eslint-import-resolver-alias": "^1.1.2",
26
+ "eslint-plugin-babel": "^5.3.1",
27
+ "eslint-plugin-hooks": "^0.4.3",
28
+ "eslint-plugin-import": "^2.26.0",
29
+ "eslint-plugin-jest": "^26.1.5",
30
+ "eslint-plugin-jsx-a11y": "^6.5.1",
31
+ "eslint-plugin-node": "^11.1.0",
32
+ "eslint-plugin-prefer-arrow-functions": "^3.1.4",
33
+ "eslint-plugin-prettier": "^4.0.0",
34
+ "eslint-plugin-react": "^7.29.4",
35
+ "eslint-plugin-react-hooks": "^4.5.0",
36
+ "eslint-plugin-sort-keys-fix": "^1.1.2",
37
+ "eslint-plugin-typescript-sort-keys": "^2.1.0"
38
+ },
39
+ "homepage": "https://github.com/centreon/centreon-frontend#readme",
40
+ "files": [
41
+ "eslint",
42
+ "jest",
43
+ "tsconfig",
44
+ "webpack",
45
+ "cypress"
46
+ ]
59
47
  }
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "downlevelIteration": true,
4
- "module": "ESNext",
5
3
  "moduleResolution": "node",
6
- "target": "es2018",
4
+ "downlevelIteration": true,
5
+ "module": "es6",
6
+ "target": "es6",
7
7
  "jsx": "react-jsx",
8
8
  "strict": true,
9
9
  "noImplicitAny": false,
10
10
  "skipLibCheck": true,
11
- "esModuleInterop": true,
12
- "resolveJsonModule": true
11
+ "esModuleInterop": true
13
12
  }
14
13
  }
@@ -0,0 +1,130 @@
1
+ const path = require('path');
2
+
3
+ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
4
+ const { ModuleFederationPlugin } = require('webpack').container;
5
+
6
+ const excludeNodeModulesExceptCentreonUi =
7
+ /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
8
+
9
+ const getBaseConfiguration = ({
10
+ moduleName,
11
+ moduleFederationConfig,
12
+ jscTransformConfiguration
13
+ }) => ({
14
+ cache: false,
15
+ module: {
16
+ rules: [
17
+ {
18
+ parser: { system: false },
19
+ test: /\.[cm]?(j|t)sx?$/
20
+ },
21
+ {
22
+ exclude: excludeNodeModulesExceptCentreonUi,
23
+ test: /\.[jt]sx?$/,
24
+ use: {
25
+ loader: 'swc-loader',
26
+ options: {
27
+ jsc: {
28
+ parser: {
29
+ syntax: 'typescript',
30
+ tsx: true
31
+ },
32
+ transform: jscTransformConfiguration
33
+ }
34
+ }
35
+ }
36
+ },
37
+ {
38
+ test: /\.icon.svg$/,
39
+ use: ['@svgr/webpack']
40
+ },
41
+ {
42
+ exclude: excludeNodeModulesExceptCentreonUi,
43
+ test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
44
+ use: [
45
+ {
46
+ loader: 'url-loader',
47
+ options: {
48
+ limit: 10000,
49
+ name: '[name].[hash:8].[ext]'
50
+ }
51
+ }
52
+ ]
53
+ }
54
+ ]
55
+ },
56
+ optimization: {
57
+ splitChunks: {
58
+ chunks: 'all',
59
+ maxSize: 400 * 1024
60
+ }
61
+ },
62
+ output: {
63
+ chunkFilename: '[name].[chunkhash:8].chunk.js',
64
+ filename: '[name].[chunkhash:8].js',
65
+ libraryTarget: 'umd',
66
+ umdNamedDefine: true
67
+ },
68
+ plugins: [
69
+ new CleanWebpackPlugin(),
70
+ moduleName &&
71
+ new ModuleFederationPlugin({
72
+ filename: 'remoteEntry.[chunkhash:8].js',
73
+ library: { name: moduleName, type: 'var' },
74
+ name: moduleName,
75
+ shared: [
76
+ {
77
+ '@centreon/ui-context': {
78
+ requiredVersion: '22.10.0',
79
+ singleton: true
80
+ }
81
+ },
82
+ {
83
+ jotai: {
84
+ requiredVersion: '1.x',
85
+ singleton: true
86
+ }
87
+ },
88
+ {
89
+ 'jotai-suspense': {
90
+ requiredVersion: '0.1.x',
91
+ singleton: true
92
+ }
93
+ },
94
+ {
95
+ react: {
96
+ requiredVersion: '18.x',
97
+ singleton: true
98
+ }
99
+ },
100
+ {
101
+ 'react-dom': {
102
+ requiredVersion: '18.x',
103
+ singleton: true
104
+ }
105
+ },
106
+ {
107
+ 'react-i18next': {
108
+ requiredVersion: '11.x',
109
+ singleton: true
110
+ }
111
+ },
112
+ {
113
+ 'react-router-dom': {
114
+ requiredVersion: '6.x',
115
+ singleton: true
116
+ }
117
+ }
118
+ ],
119
+ ...moduleFederationConfig
120
+ })
121
+ ].filter(Boolean),
122
+ resolve: {
123
+ alias: {
124
+ react: path.resolve('./node_modules/react')
125
+ },
126
+ extensions: ['.js', '.jsx', '.ts', '.tsx']
127
+ }
128
+ });
129
+
130
+ module.exports = getBaseConfiguration;
@@ -0,0 +1,24 @@
1
+ module.exports = {
2
+ devJscTransformConfiguration: {
3
+ react: {
4
+ development: true,
5
+ refresh: false,
6
+ },
7
+ },
8
+ devRefreshJscTransformConfiguration: {
9
+ react: {
10
+ development: true,
11
+ refresh: true,
12
+ },
13
+ },
14
+ getDevConfiguration: () => ({
15
+ cache: true,
16
+ devtool: 'eval-cheap-module-source-map',
17
+ optimization: {
18
+ splitChunks: false,
19
+ },
20
+ output: {
21
+ filename: '[name].js',
22
+ },
23
+ }),
24
+ };
@@ -1,6 +1,6 @@
1
1
  const os = require('os');
2
2
 
3
- const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
3
+ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
4
4
 
5
5
  const devServerPort = 9090;
6
6
 
@@ -19,9 +19,10 @@ const devServerAddress = externalInterface
19
19
 
20
20
  const publicPath = `http://${devServerAddress}:${devServerPort}/static/`;
21
21
 
22
- const isDevelopmentMode = process.env.NODE_ENV !== 'production';
22
+ const isServeMode = process.env.WEBPACK_ENV === 'serve';
23
+ const isDevelopmentMode = process.env.WEBPACK_ENV === 'development';
23
24
 
24
- const devServerPlugins = isDevelopmentMode ? [new ReactRefreshPlugin()] : [];
25
+ const devServerPlugins = isServeMode ? [new ReactRefreshWebpackPlugin()] : [];
25
26
 
26
27
  module.exports = {
27
28
  devServer: {
@@ -31,5 +32,6 @@ module.exports = {
31
32
  },
32
33
  devServerPlugins,
33
34
  isDevelopmentMode,
35
+ isServeMode,
34
36
  publicPath
35
37
  };