@ovh-ux/manager-webpack-config 6.1.2 → 7.0.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,34 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.0.1](https://github.com/ovh/manager/compare/@ovh-ux/manager-webpack-config@7.0.0...@ovh-ux/manager-webpack-config@7.0.1) (2023-12-05)
7
+
8
+ **Note:** Version bump only for package @ovh-ux/manager-webpack-config
9
+
10
+
11
+
12
+
13
+
14
+ # [7.0.0](https://github.com/ovh/manager/compare/@ovh-ux/manager-webpack-config@6.1.2...@ovh-ux/manager-webpack-config@7.0.0) (2023-09-07)
15
+
16
+
17
+ ### Build System
18
+
19
+ * bump nodejs to v18 and webpack to v5 ([6270204](https://github.com/ovh/manager/commit/6270204e59bbfb87ec000c5853be08027affbb69))
20
+
21
+
22
+ ### BREAKING CHANGES
23
+
24
+ * bump webpack from v4 to v5
25
+
26
+ Signed-off-by: Florian Renaut <florian.renaut@corp.ovh.com>
27
+ Co-authored-by: Jisay <jean-christophe.alleman@corp.ovh.com>
28
+ Co-authored-by: Anoop N <anoop.n@ovhcloud.com>
29
+
30
+
31
+
32
+
33
+
6
34
  ## [6.1.2](https://github.com/ovh/manager/compare/@ovh-ux/manager-webpack-config@6.1.1...@ovh-ux/manager-webpack-config@6.1.2) (2023-01-19)
7
35
 
8
36
  **Note:** Version bump only for package @ovh-ux/manager-webpack-config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovh-ux/manager-webpack-config",
3
- "version": "6.1.2",
3
+ "version": "7.0.1",
4
4
  "description": "OVHcloud manager shared webpack configuration.",
5
5
  "keywords": [
6
6
  "configuration",
@@ -19,52 +19,46 @@
19
19
  "author": "OVH SAS",
20
20
  "main": "./src/index.js",
21
21
  "dependencies": {
22
- "@babel/generator": "^7.10.3",
23
- "@babel/parser": "^7.10.3",
24
- "@babel/plugin-proposal-class-properties": "^7.10.1",
25
- "@babel/plugin-proposal-optional-chaining": "^7.10.1",
26
- "@babel/plugin-proposal-private-methods": "^7.10.1",
22
+ "@babel/core": "^7.20.2",
23
+ "@babel/generator": "^7.20.3",
24
+ "@babel/parser": "^7.20.3",
25
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
26
+ "@babel/plugin-proposal-optional-chaining": "^7.18.9",
27
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
27
28
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
28
- "@babel/preset-env": "^7.10.3",
29
- "@ovh-ux/component-rollup-config": "^12.0.2",
30
- "@ovh-ux/manager-webpack-dev-server": "^3.0.0",
31
- "acorn": "^6.0.5",
32
- "acorn-class-fields": "^0.3.7",
29
+ "@babel/preset-env": "^7.20.2",
30
+ "@ovh-ux/component-rollup-config": "^13.0.1",
31
+ "@ovh-ux/manager-webpack-dev-server": "^4.0.0",
32
+ "acorn": "^8.8.1",
33
+ "acorn-class-fields": "^1.0.0",
33
34
  "acorn-dynamic-import": "^4.0.0",
34
35
  "acorn-optional-chaining": "^0.0.3",
35
- "acorn-private-methods": "^0.3.3",
36
+ "acorn-private-methods": "^1.0.0",
36
37
  "babel-eslint": "^10.1.0",
37
- "babel-loader": "^8.1.0",
38
+ "babel-loader": "^9.1.0",
38
39
  "babel-plugin-angularjs-annotate": "^0.10.0",
39
- "cache-loader": "^4.1.0",
40
- "copy-webpack-plugin": "^4.6.0",
41
- "core-js": "^3.6.5",
42
- "css-loader": "^4.3.0",
43
- "file-loader": "^4.0.0",
40
+ "copy-webpack-plugin": "^11.0.0",
41
+ "core-js": "^3.26.0",
42
+ "css-loader": "^6.7.1",
43
+ "file-loader": "^6.2.0",
44
44
  "html-minifier": "^4.0.0",
45
- "html-webpack-plugin": "^4.5.0",
46
- "http-proxy-middleware": "^0.19.1",
45
+ "html-webpack-plugin": "^5.5.0",
47
46
  "less": "~3.9.0",
48
- "less-loader": "^7.0.2",
47
+ "less-loader": "^11.1.0",
49
48
  "less-plugin-remcalc": "^0.1.0",
50
- "loader-utils": "^2.0.0",
51
- "lodash": "^4.17.15",
52
- "mini-css-extract-plugin": "~1.2.1",
53
- "node-sass": "^7.0.1",
54
- "optimize-css-assets-webpack-plugin": "^5.0.3",
49
+ "lodash": "^4.17.21",
50
+ "mini-css-extract-plugin": "^2.6.1",
55
51
  "raw-loader": "^4.0.2",
56
- "regenerator-runtime": "^0.13.7",
52
+ "regenerator-runtime": "^0.13.10",
57
53
  "resolve-url-loader": "^3.0.0",
58
- "sass-loader": "^10.2.0",
54
+ "sass": "^1.56.0",
55
+ "sass-loader": "^13.1.0",
59
56
  "script-loader": "^0.7.2",
60
- "style-loader": "^2.0.0",
61
- "terser-webpack-plugin": "^4.2.2",
62
- "url-loader": "^4.1.1",
63
- "webpack": "^4.44.2",
64
- "webpack-bundle-analyzer": "^3.9.0",
65
- "webpack-cli": "^3.3.12",
66
- "webpack-merge": "^4.2.2",
67
- "webpack-retry-chunk-load-plugin": "^1.4.0",
68
- "webpackbar": "^4.0.0"
57
+ "terser-webpack-plugin": "^5.3.6",
58
+ "webpack": "^5.76.2",
59
+ "webpack-cli": "^4.10.0",
60
+ "webpack-merge": "^5.8.0",
61
+ "webpack-retry-chunk-load-plugin": "^3.1.1",
62
+ "webpackbar": "^5.0.2"
69
63
  }
70
64
  }
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const merge = require('webpack-merge');
1
+ const { merge } = require('webpack-merge');
2
2
  const devServer = require('@ovh-ux/manager-webpack-dev-server');
3
3
  const common = require('./webpack.common');
4
4
  const prodConfig = require('./webpack.prod');
@@ -1,4 +1,3 @@
1
- const loaderUtils = require('loader-utils');
2
1
  const get = require('lodash/get');
3
2
  const merge = require('lodash/merge');
4
3
  const pick = require('lodash/pick');
@@ -9,11 +8,10 @@ const privateMethods = require('acorn-private-methods');
9
8
  const componentConfig = require('@ovh-ux/component-rollup-config');
10
9
  const acornDynamicImport = require('acorn-dynamic-import');
11
10
 
12
- const getOptions = Object.assign(loaderUtils.getOptions);
13
11
  const dynamicImport = acornDynamicImport.default;
14
12
 
15
13
  module.exports = function injectTranslationsLoader(source) {
16
- const options = merge({ filtering: false }, getOptions(this));
14
+ const options = merge({ filtering: false }, this.getOptions());
17
15
  const translationInject = get(componentConfig, 'plugins.translationInject');
18
16
 
19
17
  const parser = acorn.Parser.extend(dynamicImport)
@@ -1,4 +1,3 @@
1
- const loaderUtils = require('loader-utils');
2
1
  const get = require('lodash/get');
3
2
  const merge = require('lodash/merge');
4
3
  const pick = require('lodash/pick');
@@ -9,11 +8,10 @@ const privateMethods = require('acorn-private-methods');
9
8
  const componentConfig = require('@ovh-ux/component-rollup-config');
10
9
  const acornDynamicImport = require('acorn-dynamic-import');
11
10
 
12
- const getOptions = Object.assign(loaderUtils.getOptions);
13
11
  const dynamicImport = acornDynamicImport.default;
14
12
 
15
13
  module.exports = function translationUiRouterLoader(source) {
16
- const options = merge({ filtering: false }, getOptions(this));
14
+ const options = merge({ filtering: false }, this.getOptions());
17
15
  const translationUiRouter = get(
18
16
  componentConfig,
19
17
  'plugins.translationUiRouter',
@@ -7,7 +7,6 @@ const get = require('lodash/get');
7
7
  const set = require('lodash/set');
8
8
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
9
9
  const TerserJSPlugin = require('terser-webpack-plugin');
10
- const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
11
10
  const webpackRetryChunckLoadPlugin = require('webpack-retry-chunk-load-plugin');
12
11
 
13
12
  const RetryChunkLoadPlugin = Object.assign(
@@ -16,13 +15,6 @@ const RetryChunkLoadPlugin = Object.assign(
16
15
 
17
16
  const webpack = require('webpack');
18
17
 
19
- const cacheLoader = {
20
- loader: 'cache-loader',
21
- options: {
22
- cacheDirectory: path.resolve(process.cwd(), 'node_modules/.cache-loader'),
23
- },
24
- };
25
-
26
18
  // The common webpack configuration
27
19
 
28
20
  module.exports = (opts) => {
@@ -47,14 +39,28 @@ module.exports = (opts) => {
47
39
  /\/dist/, // bundled files
48
40
  ];
49
41
 
50
- return {
51
- plugins: [
42
+ const plugins = [];
43
+ const toCopy = [
44
+ ...get(opts, 'assets.files', []),
45
+ ...get(opts, 'assets.options', []),
46
+ ];
47
+
48
+ if (toCopy.length) {
49
+ plugins.push(
52
50
  // copy application assets
53
51
  // note: we could use the html-loader plugin but it wouldn't work for dynamic src attributes!
54
- new CopyWebpackPlugin(
55
- get(opts, 'assets.files', []),
56
- get(opts, 'assets.options', {}),
57
- ),
52
+ new CopyWebpackPlugin({
53
+ patterns: toCopy,
54
+ }),
55
+ );
56
+ }
57
+
58
+ return {
59
+ output: {
60
+ publicPath: '',
61
+ },
62
+ plugins: [
63
+ ...plugins,
58
64
 
59
65
  // see : https://github.com/jantimon/html-webpack-plugin
60
66
  new HtmlWebpackPlugin({
@@ -70,6 +76,7 @@ module.exports = (opts) => {
70
76
  new MiniCssExtractPlugin({
71
77
  filename: '[name].[contenthash].css',
72
78
  chunkFilename: '[id].css',
79
+ ignoreOrder: true,
73
80
  }),
74
81
 
75
82
  new webpack.DefinePlugin({
@@ -96,6 +103,7 @@ module.exports = (opts) => {
96
103
  modules: [
97
104
  './node_modules', // #1 check in module's relative node_module directory
98
105
  path.resolve('./node_modules'), // #2 check in application's node_module directory
106
+ path.resolve(__dirname, '../node_modules'), // #3 check in webpack config directory
99
107
  ],
100
108
  },
101
109
 
@@ -110,11 +118,7 @@ module.exports = (opts) => {
110
118
  // load images & fonts into file or convert to base64 if size < 10Kib
111
119
  {
112
120
  test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
113
- loader: 'url-loader',
114
- options: {
115
- limit: 10000,
116
- esModule: false,
117
- },
121
+ type: 'asset',
118
122
  },
119
123
 
120
124
  // load css files
@@ -122,7 +126,6 @@ module.exports = (opts) => {
122
126
  test: /\.css$/,
123
127
  use: [
124
128
  MiniCssExtractPlugin.loader,
125
- cacheLoader,
126
129
  {
127
130
  loader: 'css-loader', // translates CSS into CommonJS
128
131
  },
@@ -140,7 +143,6 @@ module.exports = (opts) => {
140
143
  test: /\.less$/,
141
144
  use: [
142
145
  MiniCssExtractPlugin.loader,
143
- cacheLoader,
144
146
  {
145
147
  loader: 'css-loader', // translates CSS into CommonJS
146
148
  },
@@ -162,9 +164,15 @@ module.exports = (opts) => {
162
164
  test: /\.scss$/,
163
165
  use: [
164
166
  MiniCssExtractPlugin.loader,
165
- cacheLoader,
166
167
  'css-loader', // translates CSS into CommonJS
167
- 'sass-loader', // compiles Sass to CSS
168
+ {
169
+ loader: 'sass-loader',
170
+ options: {
171
+ sassOptions: {
172
+ quietDeps: true,
173
+ },
174
+ },
175
+ },
168
176
  ],
169
177
  },
170
178
 
@@ -172,9 +180,12 @@ module.exports = (opts) => {
172
180
  {
173
181
  test: /Messages_\w+_\w+\.json$/,
174
182
  use: [
175
- cacheLoader,
176
183
  {
177
184
  loader: path.resolve(__dirname, './loaders/translation-json.js'),
185
+ options: {
186
+ cacheCompression: false,
187
+ cacheDirectory: true,
188
+ },
178
189
  },
179
190
  ],
180
191
  },
@@ -184,10 +195,11 @@ module.exports = (opts) => {
184
195
  test: /\.js$/,
185
196
  exclude: jsExclude,
186
197
  use: [
187
- cacheLoader,
188
198
  {
189
199
  loader: 'babel-loader', // babelify JS sources
190
200
  options: {
201
+ cacheCompression: false,
202
+ cacheDirectory: true,
191
203
  presets: [
192
204
  require.resolve('@babel/preset-env'), // babel preset configuration
193
205
  ],
@@ -211,7 +223,6 @@ module.exports = (opts) => {
211
223
  exclude: jsExclude,
212
224
  enforce: 'pre',
213
225
  use: [
214
- cacheLoader,
215
226
  {
216
227
  loader: path.resolve(
217
228
  __dirname,
@@ -231,7 +242,6 @@ module.exports = (opts) => {
231
242
  exclude: jsExclude,
232
243
  enforce: 'pre',
233
244
  use: [
234
- cacheLoader,
235
245
  {
236
246
  loader: path.resolve(
237
247
  __dirname,
@@ -247,7 +257,7 @@ module.exports = (opts) => {
247
257
  }, // \module
248
258
 
249
259
  optimization: {
250
- minimizer: [new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})],
260
+ minimizer: [new TerserJSPlugin({})],
251
261
  runtimeChunk: 'single',
252
262
  // bundle spliting configuration
253
263
  splitChunks: {