fix: circular dependencies (#1040)
This commit is contained in:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user