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

I'm experiencing bug with webpack 5 #23795

Closed
ktjd123 opened this issue Apr 8, 2021 · 3 comments
Closed

I'm experiencing bug with webpack 5 #23795

ktjd123 opened this issue Apr 8, 2021 · 3 comments
Labels
bug Issue was opened via the bug report template.

Comments

@ktjd123
Copy link

ktjd123 commented Apr 8, 2021

What version of Next.js are you using?

10.0.2

What version of Node.js are you using?

12.20.2

What browser are you using?

Chrome

What operating system are you using?

macOs

How are you deploying your application?

using custom server., next build

Describe the Bug

When I set sassOptions at next.config.js it spits error.

I think this bug is related to webpack 5 since using webpack 4 doesn't says anything

Expected Behavior

Work smoothly

To Reproduce

add additional data to sassOptions in next.config.js

next.config.js

module.exports = {
  future: {
    webpack5: true,
  },
  sassOptions: {
    includePaths: ['styles'],
    additionalData: "@import 'utils';",
  },
};
./node_modules/next/dist/compiled/css-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[1]!./node_modules/next/dist/compiled/postcss-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[2]!./node_modules/next/dist/compiled/resolve-url-loader/index.js??ruleSet[1].rules[2].oneOf[3].use[3]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[4]!./components/Setting/index.module.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:
 * "styles/_utils"
 * "styles/_utils.css"
 * "styles/_utils.sass"
 * and more ...

./node_modules/next/dist/compiled/css-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[1]!./node_modules/next/dist/compiled/postcss-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[2]!./node_modules/next/dist/compiled/resolve-url-loader/index.js??ruleSet[1].rules[2].oneOf[3].use[3]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[4]!./components/Star/index.module.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:
 * "styles/_utils"
 * "styles/_utils.css"
 * "styles/_utils.sass"
 * and more ...

./node_modules/next/dist/compiled/css-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[1]!./node_modules/next/dist/compiled/postcss-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[2]!./node_modules/next/dist/compiled/resolve-url-loader/index.js??ruleSet[1].rules[2].oneOf[3].use[3]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[2].oneOf[3].use[4]!./components/Upload/index.module.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:
 * "styles/_utils"
 * "styles/_utils.css"
 * "styles/_utils.sass"
 * and more ...
 .
.
.
.

Always thank you for great works.

@ktjd123 ktjd123 added the bug Issue was opened via the bug report template. label Apr 8, 2021
@maerzhase
Copy link
Contributor

maerzhase commented Apr 21, 2021

@ktjd123 you could try to resolve the issue by the description provided in the error message. You are setting the paths via a string that is interpreted as an absolute path. Take a look at he next docs. You should use e.g. path.join to have a proper absolute path: https://nextjs.org/docs/basic-features/built-in-css-support#customizing-sass-options

@ijjk
Copy link
Member

ijjk commented Apr 28, 2021

The above next.config.js appears to be working correctly in the latest version of Next.js v10.1.3

@ijjk ijjk closed this as completed Apr 28, 2021
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

4 participants