Browse Source

fix: Webpack config object

Update webpack.config.js to be compatible with version >=5
Lucas de Souza 2 years ago
parent
commit
cefc662b3c
1 changed files with 75 additions and 55 deletions
  1. 75 55
      webpack.config.js

+ 75 - 55
webpack.config.js

@@ -13,9 +13,6 @@ module.exports = {
     library: "ivprogCore",
     libraryTarget: "umd",
   },
-  node: {
-    fs: "empty",
-  },
   module: {
     rules: [
       {
@@ -46,6 +43,9 @@ module.exports = {
   },
   resolve: {
     extensions: [".tsx", ".ts", ".js", ".csv"],
+    fallback: {
+      fs: false,
+    },
   },
   stats: {
     colors: true,
@@ -69,59 +69,79 @@ module.exports = {
       filename: path.resolve(__dirname, "build", "process.html"),
     }),
     /*new ChangeScriptSourcePlugin(),*/
-    new CopyPlugin([
-      {
-        from: "js/iassign-integration-functions.js",
-        to: path.resolve(__dirname, "build/js"),
-      },
-      {
-        from: "css/ivprog-visual-1.0.css",
-        to: path.resolve(__dirname, "build/css"),
-      },
-      { from: "css/ivprog-term.css", to: path.resolve(__dirname, "build/css") },
-      {
-        from: "css/ivprog-assessment.css",
-        to: path.resolve(__dirname, "build/css"),
-      },
-      {
-        from: "css/ivprog-editor.css",
-        to: path.resolve(__dirname, "build/css"),
-      },
-      { from: "css/roboto.css", to: path.resolve(__dirname, "build/css") },
-      { from: "css/fonts/", to: path.resolve(__dirname, "build/css/fonts") },
-      { from: "js/Sortable.js", to: path.resolve(__dirname, "build/js") },
-      { from: "js/jquery.min.js", to: path.resolve(__dirname, "build/js") },
-      { from: "js/jquery-ui.min.js", to: path.resolve(__dirname, "build/js") },
-      { from: "js/semantic.min.js", to: path.resolve(__dirname, "build/js") },
-      { from: "js/filesaver.min.js", to: path.resolve(__dirname, "build/js") },
-      {
-        from: "css/semantic.min.css",
-        to: path.resolve(__dirname, "build/css"),
-      },
-      { from: "css/themes/", to: path.resolve(__dirname, "build/css/themes") },
-      { from: "img/trash-icon.png", to: path.resolve(__dirname, "build/img") },
-      { from: "img/empty.svg", to: path.resolve(__dirname, "build/img") },
-      { from: "img/new_line.svg", to: path.resolve(__dirname, "build/img") },
-      { from: "img/no_new_line.svg", to: path.resolve(__dirname, "build/img") },
-      {
-        from: "js/jquery.json-editor.min.js",
-        to: path.resolve(__dirname, "build/js"),
-      },
-      {
-        from: "node_modules/codemirror/lib/codemirror.css",
-        to: path.resolve(__dirname, "build/css"),
-      },
-      {
-        from: "node_modules/codemirror/addon/hint/show-hint.css",
-        to: path.resolve(__dirname, "build/css"),
-      },
-      {
-        from: "node_modules/codemirror/theme/ttcn.css",
-        to: path.resolve(__dirname, "build/css"),
-      },
-      /*{from:'index.html', to:path.resolve(__dirname, 'build')},
+    new CopyPlugin({
+      patterns: [
+        {
+          from: "js/iassign-integration-functions.js",
+          to: path.resolve(__dirname, "build/js"),
+        },
+        {
+          from: "css/ivprog-visual-1.0.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        {
+          from: "css/ivprog-term.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        {
+          from: "css/ivprog-assessment.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        {
+          from: "css/ivprog-editor.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        { from: "css/roboto.css", to: path.resolve(__dirname, "build/css") },
+        { from: "css/fonts/", to: path.resolve(__dirname, "build/css/fonts") },
+        { from: "js/Sortable.js", to: path.resolve(__dirname, "build/js") },
+        { from: "js/jquery.min.js", to: path.resolve(__dirname, "build/js") },
+        {
+          from: "js/jquery-ui.min.js",
+          to: path.resolve(__dirname, "build/js"),
+        },
+        { from: "js/semantic.min.js", to: path.resolve(__dirname, "build/js") },
+        {
+          from: "js/filesaver.min.js",
+          to: path.resolve(__dirname, "build/js"),
+        },
+        {
+          from: "css/semantic.min.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        {
+          from: "css/themes/",
+          to: path.resolve(__dirname, "build/css/themes"),
+        },
+        {
+          from: "img/trash-icon.png",
+          to: path.resolve(__dirname, "build/img"),
+        },
+        { from: "img/empty.svg", to: path.resolve(__dirname, "build/img") },
+        { from: "img/new_line.svg", to: path.resolve(__dirname, "build/img") },
+        {
+          from: "img/no_new_line.svg",
+          to: path.resolve(__dirname, "build/img"),
+        },
+        {
+          from: "js/jquery.json-editor.min.js",
+          to: path.resolve(__dirname, "build/js"),
+        },
+        {
+          from: "node_modules/codemirror/lib/codemirror.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        {
+          from: "node_modules/codemirror/addon/hint/show-hint.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        {
+          from: "node_modules/codemirror/theme/ttcn.css",
+          to: path.resolve(__dirname, "build/css"),
+        },
+        /*{from:'index.html', to:path.resolve(__dirname, 'build')},
         {from:'runner.html', to:path.resolve(__dirname, 'build')},*/
-    ]),
+      ],
+    }),
   ],
   optimization: {
     splitChunks: {