@centreon/js-config 24.4.9 → 24.4.11

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.
@@ -0,0 +1,71 @@
1
+ const excludeNodeModulesExceptCentreonUi =
2
+ /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
3
+
4
+ module.exports = {
5
+ cache: false,
6
+ excludeNodeModulesExceptCentreonUi,
7
+ getModuleConfiguration: (jscTransformConfiguration) => ({
8
+ rules: [
9
+ {
10
+ parser: { system: false },
11
+ test: /\.[cm]?(j|t)sx?$/
12
+ },
13
+ {
14
+ exclude: [excludeNodeModulesExceptCentreonUi],
15
+ test: /\.[jt]sx?$/,
16
+ use: {
17
+ loader: 'swc-loader',
18
+ options: {
19
+ jsc: {
20
+ parser: {
21
+ syntax: 'typescript',
22
+ tsx: true
23
+ },
24
+ transform: jscTransformConfiguration
25
+ }
26
+ }
27
+ }
28
+ },
29
+ {
30
+ test: /\.icon.svg$/,
31
+ use: ['@svgr/webpack']
32
+ },
33
+ {
34
+ exclude: excludeNodeModulesExceptCentreonUi,
35
+ test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
36
+ use: [
37
+ {
38
+ loader: 'url-loader',
39
+ options: {
40
+ limit: 10000,
41
+ name: '[name].[hash:8].[ext]'
42
+ }
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ generator: {
48
+ filename: '[name][ext]'
49
+ },
50
+ test: /\.(woff|woff2|eot|ttf|otf)$/i,
51
+ type: 'asset/resource'
52
+ },
53
+ {
54
+ test: /\.css$/i,
55
+ use: ['style-loader', 'css-loader']
56
+ }
57
+ ]
58
+ }),
59
+ optimization: {
60
+ splitChunks: {
61
+ chunks: 'all',
62
+ maxSize: 400 * 1024
63
+ }
64
+ },
65
+ output: {
66
+ chunkFilename: '[name].[chunkhash:8].chunk.js',
67
+ filename: '[name].[chunkhash:8].js',
68
+ libraryTarget: 'umd',
69
+ umdNamedDefine: true
70
+ }
71
+ };
@@ -3,74 +3,32 @@ const path = require('path');
3
3
  const { CleanWebpackPlugin } = require('clean-webpack-plugin');
4
4
  const { ModuleFederationPlugin } = require('webpack').container;
5
5
 
6
- const excludeNodeModulesExceptCentreonUi =
7
- /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
6
+ const {
7
+ getModuleConfiguration,
8
+ optimization,
9
+ output,
10
+ cache
11
+ } = require('./globalConfig');
8
12
 
9
13
  const getBaseConfiguration = ({
10
14
  moduleName,
11
15
  moduleFederationConfig,
12
16
  jscTransformConfiguration
13
17
  }) => ({
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
- },
18
+ cache,
19
+ module: getModuleConfiguration(jscTransformConfiguration),
20
+ optimization,
62
21
  output: {
63
- chunkFilename: '[name].[chunkhash:8].chunk.js',
64
- filename: '[name].[chunkhash:8].js',
65
- libraryTarget: 'umd',
66
- umdNamedDefine: true
22
+ ...output,
23
+ library: moduleName,
24
+ uniqueName: moduleName
67
25
  },
68
26
  plugins: [
69
27
  new CleanWebpackPlugin(),
70
28
  moduleName &&
71
29
  new ModuleFederationPlugin({
72
30
  filename: 'remoteEntry.[chunkhash:8].js',
73
- library: { name: moduleName, type: 'var' },
31
+ library: { name: moduleName, type: 'umd' },
74
32
  name: moduleName,
75
33
  shared: [
76
34
  {
@@ -121,6 +79,9 @@ const getBaseConfiguration = ({
121
79
  ].filter(Boolean),
122
80
  resolve: {
123
81
  alias: {
82
+ '@centreon/ui/fonts': path.resolve(
83
+ './node_modules/@centreon/ui/public/fonts'
84
+ ),
124
85
  react: path.resolve('./node_modules/react')
125
86
  },
126
87
  extensions: ['.js', '.jsx', '.ts', '.tsx']