Skip to content
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

Not working with Webpack > 5.11 #96

Closed
thecreazy opened this issue Jan 11, 2021 · 2 comments
Closed

Not working with Webpack > 5.11 #96

thecreazy opened this issue Jan 11, 2021 · 2 comments

Comments

@thecreazy
Copy link

With the 5.11.1 version of Webpack the importer made it go in an infinite loop if using the watch options, the isse reported from me at Webpack is there webpack/webpack#12340

Fortunately webpack in the new version, thanks to the report, has added warnings in case of incorrect use of the addDependency for non-absolute paths

I created a repo where you can test the bug: https://github.com/thecreazy/webpack-bug-example-repo

the warnings displayed are the following:

Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
Invalid dependencies may lead to broken watching and caching.
As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior.
Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories).
Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories).
Globs: They are not supported. Pass absolute path to the directory as context dependencies.
The following invalid values have been reported:
 * "macros/package.json"
 * "../../../conf/json/sass.json"
 @ ./src/neewl/js/client.js 4:0-28
@loilo
Copy link

loilo commented Feb 13, 2021

TL;DR: This is an issue with sass-loader, not this package, and has been resolved in sass-loader@11.0.1.


The problem is not this package, it has been in sass-loader, which calls addDependency for all files that Sass reportedly included in its rendering process.

However, because custom importers like this package can basically do anything they want with an import source string (see node-magic-sass-importer for a good example of that), Sass is not able to reliably resolve those source strings to absolute paths and instead reports them as-is.

The good news is: This has been resolved in sass-loader@11.0.1 (see webpack-contrib/sass-loader#913), which now first checks each item in the included files reported by Sass, and only calls addDependency if it is an absolute path.

Therefore (since it's fixed and it's not the responsibility of this package), this issue should be closed.

@efeminella
Copy link

efeminella commented Oct 18, 2021

I'm on 4.3.0 but am still seeing this issue ... Is node-sass-json-importer using sass-loader >= 11.0.1? And if so, why is the issue still being reported? I'm still receiving the following:

cjs.js??ruleSet[1].rules[3].oneOf[7].use[2]!./node_modules/next/dist/compiled/resolve-url-loader/index.js??ruleSet[1].rules[3].oneOf[7].use[3]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[3].oneOf[7].use[4]!../applications/src/styles/index.scss
Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
Invalid dependencies may lead to broken watching and caching.
As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior.
Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories).
Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories).
Globs: They are not supported. Pass absolute path to the directory as context dependencies.
The following invalid values have been reported:
 * "theme.json5"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants