-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack@5 support #60
Comments
Can you post the version of webpack and plugins you're using from your lockfile? |
Did not occur with webpack 4.44.2 -> now occurs with webpack 5.0.0
|
Sorry, I'm doing several things at once and @jlchereau was faster, but it's a relevant ... both webpack and the set of plugins. I think the new webpack is the most relevant part |
@jlchereau those appear to be the versions from your package.json, I would like to see the exact version from |
This concerns the final release of webpack@5 dated 2 days ago: https://github.com/webpack/webpack/releases/tag/v5.0.0. I have never tried any of the release candidates.
|
I'm at TS and SASS for a very long time |
I get a circular dependency detected in every file (even index.html) with webpack 5.1.3. Same with webpack 5.0.0. Working fine with webpack 4.44.2.
|
@eirikaho might have to do with |
I'll take a look at webpack 5.1, but my tests are relatively thorough for integration with webpack 4.x.x and 5.0.0 with no other plugins. Which is what I've focused on so far. If you are having an issue with how this plugin works in the presence of other plugins please include a listing of the specific webpack version, and versions of all webpack plugins, along with the specific output you are seeing which you feel is a bug. |
If it helps, my Lit Element starter repo is showing this problem https://github.com/xenobytezero/lit-element-starter I have commented out the plugin in the webpack.config.js, uncommenting should show the error we are seeing. Webpack - 5.1.3
|
FWIW a get theese now after I've revisited the webpack upgrade (just a snippet, there's hundreds of these):
|
fwiw, i'm also seeing this, also on every file in the repo. I turned off all plugins. I am running with node 12, and the following packages:
My stripped down webpack file is:
NOTE: I am running this with I'm sorry that I don't have time right now to set up a demo repo. I'll try to take a look next sprint. |
I've just published 5.2.1. I have a good feeling that the new version will solve the issue everyone in this thread has experienced. I'll wait to close this until someone else can confirm. |
I've installed 5.2.1 and confirmed the problem gone. I think you can close the issue. Thanks for the work. |
Thanks @tranvansang |
So … I've tried to upgrade and I still get cycles with just two This is my plugin config const CircularDependencyPlugin = require('circular-dependency-plugin');
plugins.development.push(
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /node_modules/,
// add errors to webpack instead of warnings
failOnError: false,
// set the current working directory for displaying module paths
cwd: paths.ui,
/**
* called for each module that is cyclical
*
* @example CLI output
* Error in Circular dependency detected!
* * path/to/file/a.js
* → path/to/file/b.js
* → path/to/file/a.js
*/
onDetected({
// `paths` will be an Array of the relative module paths that make up the cycle
paths: cyclePaths,
compilation,
}) {
const err = new Error(`Circular dependency detected!\n * ${cyclePaths.join('\n → ')}`);
compilation.warnings.push(err);
},
}),
);
I don't get it really… what would help you find the culprit? |
Here's an excerpt from my
…and this is a loader config that might be relevant {
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
// Our sources & `node_modules` that require compilation
include: [
paths.ui,
/node_modules\/d3-\w+/,
/node_modules\/react-intl/,
/node_modules\/intl-messageformat/,
/node_modules\/intl-messageformat-parser/,
/node_modules\/slushpool/,
],
use: [
getCacheLoaderConfig(JSON.stringify(settings)),
{
loader: 'babel-loader',
options: { rootMode: 'upward', cacheDirectory: false },
},
],
} … and this is my /* eslint-disable */
const paths = require('./conf/settings.paths');
const settings = require('./shared/res/constants/settings.json');
const presets = {
react: [
'@babel/preset-react',
// TODO: This breaks in storybook & typescript, so let's wait…
// { runtime: 'classic' },
],
ts: [
'@babel/preset-typescript',
{
isTSX: true,
allExtensions: true,
allowNamespaces: false,
},
],
env: {
es: [
'@babel/preset-env',
{
modules: false,
loose: false,
shippedProposals: true,
useBuiltIns: 'entry',
corejs: {
version: 3,
proposals: false,
},
},
],
node: [
'@babel/preset-env',
{
modules: 'commonjs',
targets: { node: 'current' },
loose: false,
shippedProposals: true,
},
],
},
};
module.exports = {
presets: [presets.react, presets.env.es, presets.ts],
plugins: [
['./shared/dev/plugins/babel-i18n', { commentPreffix: 'translators:', rootPath: paths.ui }],
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-private-property-in-object',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx-source',
'transform-inline-environment-variables',
'react-hot-loader/babel',
'macros',
],
env: {
development: {
plugins: [['babel-plugin-typescript-to-proptypes', { forbidExtraProps: false }]],
},
production: {
plugins: [
'@babel/plugin-transform-react-constant-elements',
'transform-remove-debugger',
'transform-undefined-to-void',
'lodash',
],
},
test: {
presets: [presets.react, presets.env.node, presets.ts],
},
node: {
presets: [presets.react, presets.env.node, presets.ts],
plugins: [
[
require.resolve('babel-plugin-module-resolver'),
{
root: [paths.ui, paths.uiShared],
extensions: ['.js', '.jsx', '.css', '.scss', '.json'],
},
],
[
'transform-define',
{
'process.env.NODE_ENV': JSON.stringify(true),
__DEV__: JSON.stringify(false),
FEATURE_LTC_XMR_ACTIVATED: settings.LTC_XMR_ACTIVATED,
FEATURE_DEMO_ENABLED: settings.DEMO_LOGIN_ENABLED,
},
],
],
},
},
}; |
@kubijo please try version 5.2.2. I discovered an issue that affected modules compiled with typescript. More generally this plugin will now ignore all circular dependencies where a module appears to be directly importing itself due to the way webpack internals codifies dependencies. |
@aackerman 5.2.2 worked for me! Thank you very much! |
Hi. Thanks for your work on this. What I come with is a question that sooner or later surely would come anyway and that is whether you are planing a webpack@5 checkup.
I'm now helping with polishing out kinks in it and of issues that came up in my project are many new circular dependency errors — some of which don't make any sense like one file depend on itself.
The text was updated successfully, but these errors were encountered: