github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/craco.config.js (about)

     1  const CircularDependencyPlugin = require("circular-dependency-plugin");
     2  const set = require("lodash/set");
     3  const webpack = require("webpack");
     4  
     5  module.exports = {
     6    webpack: {
     7      configure: (webpackConfig) => {
     8        const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
     9          ({ constructor }) =>
    10            constructor && constructor.name === "ModuleScopePlugin"
    11        );
    12  
    13        webpackConfig.resolve.plugins.splice(scopePluginIndex, 1);
    14  
    15        webpackConfig = set(
    16          webpackConfig,
    17          "resolve.fallback.crypto",
    18          require.resolve("crypto-browserify")
    19        );
    20        webpackConfig = set(
    21          webpackConfig,
    22          "resolve.fallback.path",
    23          require.resolve("path-browserify")
    24        );
    25        webpackConfig = set(
    26          webpackConfig,
    27          "resolve.fallback.stream",
    28          require.resolve("stream-browserify")
    29        );
    30        webpackConfig = set(webpackConfig, "resolve.fallback.fs", false);
    31        webpackConfig = set(webpackConfig, "experiments.asyncWebAssembly", true);
    32        // webpackConfig = set(webpackConfig, "experiments.syncWebAssembly", true);
    33        return webpackConfig;
    34      },
    35      plugins: [
    36        new webpack.ProvidePlugin({
    37          Buffer: ["buffer", "Buffer"],
    38          process: "process/browser.js",
    39        }),
    40        new CircularDependencyPlugin({
    41          // exclude detection of files based on a RegExp
    42          exclude: /node_modules/,
    43          // include specific files based on a RegExp
    44          include: /src/,
    45          // add errors to webpack instead of warnings
    46          failOnError: true,
    47          // allow import cycles that include an asyncronous import,
    48          // e.g. via import(/* webpackMode: "weak" */ './file.js')
    49          allowAsyncCycles: false,
    50          // set the current working directory for displaying module paths
    51          cwd: process.cwd(),
    52        }),
    53      ],
    54    },
    55  };