tabrindle / envinfo

Generate a report about your development environment for debugging and issue reporting
MIT License
760 stars 58 forks source link

Patch from debian : port to webpack 5 and newest os-name #244

Closed bastien-roucaries closed 7 months ago

bastien-roucaries commented 12 months ago

Hi

Debian use the following patch for webpack5 (external part could be removed it is a trick from debian in order to not bundle external package):

From: =?utf-8?q?Bastien_Roucari=C3=A8s?= <rouca@debian.org>
Date: Wed, 8 Nov 2023 12:26:00 +0000
Subject: Port to webpack5

forwarded: not-needed
---
 webpack.config.js | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/webpack.config.js b/webpack.config.js
index 4c49213..d2a9d53 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -13,30 +13,38 @@ module.exports = {
     minimize: true,
   },
   output: {
-    libraryTarget: 'commonjs2',
+    libraryTarget: 'commonjs',
     filename: '[name].js',
     path: path.join(__dirname, '/dist'),
   },
   module: {
     rules: [
       {
-        use: 'babel-loader',
         exclude: /(node_modules)/,
         test: /\.js$/,
+        use : {
+          loader : 'babel-loader',
+          options: {
+            presets: [
+              ['@babel/preset-env', { targets: "defaults" , "useBuiltIns": 'usage', "corejs": 3}]
+            ],
+          },
+        },
       },
     ],
   },
-  externals: [/envinfo$/],
+  externals: [
+    /envinfo$/,
+    /^(?!([.][/])?src[/]|[.][.]?[/])/,
+    ],
   plugins: [
     new webpack.BannerPlugin({
-      banner: `#!/usr/bin/env node
-      "use strict"`,
+      banner: '#!/usr/bin/node',
       raw: true,
       include: 'cli',
     }),
     new webpack.DefinePlugin({
       'global.__VERSION__': JSON.stringify(packageJson.version),
     }),
-    new webpack.IgnorePlugin(/spawn-sync/),
   ],
 };
gengjiawen commented 7 months ago

fixed.