fix: circular dependencies (#1040)

This commit is contained in:
Karol Sójko
2022-05-23 14:18:36 +02:00
committed by GitHub
parent 51248f2588
commit 0e258856d8
28 changed files with 134 additions and 107 deletions

View File

@@ -1,6 +1,7 @@
const path = require('path')
const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CircularDependencyPlugin = require('circular-dependency-plugin')
const mergeWithEnvDefaults = require('./webpack-defaults')
require('dotenv').config()
@@ -12,6 +13,19 @@ module.exports = (env) => {
filename: './javascripts/app.js',
},
plugins: [
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /a\.js|node_modules/,
// include specific files based on a RegExp
include: /app\/assets\/javascripts/,
// add errors to webpack instead of warnings
failOnError: true,
// allow import cycles that include an asyncronous import,
// e.g. via import(/* webpackMode: "weak" */ './file.js')
allowAsyncCycles: false,
// set the current working directory for displaying module paths
cwd: process.cwd(),
}),
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(require('./package.json').version),
__WEB__: JSON.stringify(env.platform === 'web'),