How to use circular-dependency-plugin - 8 common examples

To help you get started, we’ve selected a few circular-dependency-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strues / boldr / packages / boldr-dx / src / plugins / webpackPlugin / createNodeWebpack.js View on Github external
'process.browser': JSON.stringify(false),
        'process.server': JSON.stringify(true),
      }),
    ]),
  };

  if (_DEV) {
    nodeConfig.stats = 'none';
    nodeConfig.watch = true;
    nodeConfig.plugins.push(
      new CaseSensitivePathsPlugin(),
      new LoggerPlugin({
        verbose: bundle.verbose,
        target: 'server',
      }),
      new CircularDependencyPlugin({
        exclude: /a\.js|node_modules/,
        // show a warning when there is a circular dependency
        failOnError: false,
      }),
    );
  }
  return nodeConfig;
}
github pixeloven / pixeloven / packages / pixeloven-webpack / config / src / index.ts View on Github external
*/
            ifDevelopment(new TimeFixPlugin()),
            /**
             * Watcher doesn"t work well if you mistype casing in a path so we use
             * a plugin that prints an error when you attempt to do this.
             * See https://github.com/facebookincubator/create-react-app/issues/240
             *
             * @env development
             */
            ifDevelopment(new CaseSensitivePathsPlugin()),
            /**
             * Allows for circular dependency detection
             *
             * @todo should determine why we can't just push errors/strings to compilation.warnings
             */
            new CircularDependencyPlugin({
                // exclude detection of files based on a RegExp
                exclude: /node_modules/,
                onStart() {
                    numCyclesDetected = 0;
                    numCyclesDisplayed = 0;
                },
                onDetected({ paths }) {
                    if (numCyclesDetected < limitCyclesDetected) {
                        // compilation.warnings.push(new Error(`circular dependency ${paths.join(" -> ")}`));
                        logger.warn(
                            `circular dependency ${paths.join(" -> ")}`,
                        );
                        numCyclesDisplayed++;
                    }
                    numCyclesDetected++;
                },
github strues / boldr / packages / tools / src / createWebpackConfig.js View on Github external
query: {
              babelrc: false,
              cacheDirectory: _IS_DEV_,
              compact: _IS_PROD_,
              presets: [_IS_CLIENT_ ? clientPreset : serverPreset],
            },
          },
        ],
      }),

      // Improve OS compatibility
      // https://github.com/Urthen/case-sensitive-paths-webpack-plugin
      new CaseSensitivePathsPlugin(),

      _IS_DEV_
        ? new CircularDependencyPlugin({
            exclude: /a\.js|node_modules/,
            // show a warning when there is a circular dependency
            failOnError: false,
          })
        : null,

      _IS_DEV_
        ? new WriteFilePlugin({
            exitOnErrors: false,
            log: true,
            // required not to cache removed files
            useHashIndex: false,
          })
        : null,

      _IS_CLIENT_ ? new ExtractCssChunks() : null,
github strues / react-universal-boiler / tools / webpack / createWebpackConfig.js View on Github external
// @see: https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements
                // Adds component stack to warning messages
                _IS_DEV_ ? 'transform-react-jsx-source' : 'transform-react-constant-elements',
              ].filter(Boolean),
            },
          },
        ],
      }),

      // Improve OS compatibility
      // https://github.com/Urthen/case-sensitive-paths-webpack-plugin
      new CaseSensitivePathsPlugin(),
      // Detect modules with circular dependencies when bundling with webpack.
      // @see https://github.com/aackerman/circular-dependency-plugin
      _IS_DEV_
        ? new CircularDependencyPlugin({
            exclude: /a\.js|node_modules/,
            // show a warning when there is a circular dependency
            failOnError: false,
          })
        : null,

      _IS_PROD_ && _IS_CLIENT_ ? new WebpackDigestHash() : null,
      // Let the server side renderer know about our client side assets
      // https://github.com/FormidableLabs/webpack-stats-plugin
      _IS_PROD_ && _IS_CLIENT_ ? new StatsPlugin('stats.json') : null,
      // Use HashedModuleIdsPlugin to generate IDs that preserves over builds
      // @see https://github.com/webpack/webpack.js.org/issues/652#issuecomment-273324529
      // @NOTE: if using flushChunkNames rather than flushModuleIds you must disable this...
      _IS_PROD_ ? new webpack.HashedModuleIdsPlugin() : null,
      // I would recommend using NamedModulesPlugin during development (better output).
      // Via: https://github.com/webpack/webpack.js.org/issues/652#issuecomment-273023082
github mozilla / addons-frontend / webpack-common.js View on Github external
}),
    // Since the NodeJS code does not run from a webpack bundle, here
    // are a few replacements that affect only the client side bundle.
    //
    // This replaces the config with a new module that has sensitive,
    // server-only keys removed.
    new webpack.NormalModuleReplacementPlugin(
      /config$/,
      'core/client/config.js',
    ),
    // This swaps the server side window object with a standard browser window.
    new webpack.NormalModuleReplacementPlugin(
      /core\/window/,
      'core/browserWindow.js',
    ),
    new CircularDependencyPlugin({
      exclude: /node_modules/,
      failOnError: true,
    }),
  ];

  if (includeLoadablePlugin) {
    // We need this file to be written on disk so that our server code can read
    // it. In development mode, webpack usually serves the file from memory but
    // that's not what we want for this file.
    plugins.push(new LoadablePlugin({ writeToDisk: true }));
  }

  if (excludeOtherAppLocales) {
    plugins.push(
      // This allow us to exclude locales for other apps being built.
      new webpack.ContextReplacementPlugin(
github ManifoldScholar / manifold / client / webpack / config / base.config.js View on Github external
modules: false,
      colors: true
    },

    resolve: {
      modules: [paths.src, "node_modules"],
      alias: plugins.webpackAliases
    },

    plugins: [
      new MiniCssExtractPlugin({
        filename: `${nameTemplate}.css`,
        chunkFilename: `chunk-${nameTemplate}.css`
      }),

      new CircularDependencyPlugin({
        exclude: /a\.js|node_modules|src\/global\/containers\/comment\/|src\/global\/components\/comment\//,
        failOnError: true,
        cwd: paths.root
      })
    ]
  };
  return webpackConfiguration;
}
github paypal / paypal-checkout-components / webpack.config.js View on Github external
maxChunks: (chunkname ? 2 : 1)
        }),
        new webpack.DefinePlugin(vars),
        new webpack.NamedModulesPlugin(),
        new UglifyJSPlugin({
            test:     /\.js$/,
            beautify: !minify,
            minimize: minify,
            compress: {
                warnings:  false,
                sequences: minify
            },
            mangle:    minify,
            sourceMap: true
        }),
        new CircularDependencyPlugin({
            failOnError: true
        }),
        new webpack.optimize.ModuleConcatenationPlugin()
    ];

    if (!test) {
        plugins.push(new webpack.SourceMapDevToolPlugin({
            filename: '[file].map'
        }));
    }

    if (chunkname) {
        plugins.push(new WebpackPromiseShimPlugin({
            module: 'zalgo-promise/src',
            key:    'ZalgoPromise'
        }));
github strues / boldr / packages / boldr-dx / src / plugins / webpackPlugin / createBrowserWebpack.js View on Github external
path: 'css-loader',
            use: {
              importLoaders: 2,
              localIdentName: LOCAL_IDENT,
              sourceMap: false,
              modules: false,
              context: bundle.srcDir,
            },
          },
          { path: 'postcss-loader' },
          {
            path: 'fast-sass-loader',
          },
        ],
      }),
      new CircularDependencyPlugin({
        exclude: /a\.js|node_modules/,
        failOnError: false,
      }),
      new LoggerPlugin({
        verbose: bundle.verbose,
        target: 'web',
      }),
      new CaseSensitivePathsPlugin(),
      new webpack.DllReferencePlugin({
        manifest: require(path.resolve(bundle.assetsDir, '__vendor_dlls__.json')),
      }),
    );
  }
  return browserConfig;
}

circular-dependency-plugin

Detect modules with circular dependencies when bundling with webpack.

ISC
Latest version published 4 years ago

Package Health Score

69 / 100
Full package analysis

Popular circular-dependency-plugin functions

Similar packages