npm webpack how to configure to use non minified dependencies

Viewed 354

I received a notification from Google regarding an extension that I have in the web store.

We routinely review items in the Chrome Web Store for compliance with our Program policies to ensure a safe and trusted experience for our users. (...) During the course of a review, your item was found to be suspicious and has one or more file(s) that contain minified or obfuscated code which is not human readable.

I use webpack 4 to create the extension package. And I was able to configure not to minify and not to obfuscate:

mode: "production",
optimization: {
  // We no not want to minimize our code.
  minimize: false,
},

The problem is that the dependencies (React, React-Dom and SweetAlert2) are still minified.

Following this description SplitChunksPlugin was able to move the dependencies to separate files:

mode: "production",
optimization: {
  // We no not want to minimize our code.
  minimize: false,
  splitChunks: {
    // Add the dependencies in the vendors file
    cacheGroups: {
      react: {
        test: path.join(__dirname, "node_modules", "react"),
        name: 'react',
        chunks: 'all'
      },
      sweetalert2: {
        test: path.join(__dirname, "node_modules", "sweetalert2"),
        name: 'sweetalert2',
        chunks: 'all'
      }
    }
  }
},

The problem is that the dependencies are still minified. I modified the mode to development:

mode: "development",

But it adds a lot of eval and also local references and it still gets minified.

"use strict";
eval("/** @license React v16.4.2\n * react-dom.development.js\n *\n * (...)

Is it possible to generate the project with non-minified dependencies using webpack?

0 Answers
Related