question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem reading CSS files with webpack

See original GitHub issue

What version of Next.js are you using?

12.0.7

What version of Node.js are you using?

16.13.1

What browser are you using?

Firefox

What operating system are you using?

Linux

How are you deploying your application?

Vercel

Describe the Bug

I am using NextJS with typescript. I created app with npx create-next-app@latest --ts some-project.

Whenever I run npm run dev it throws an error like this

error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[2]!./styles/Home.module.css
TypeError: Cannot read properties of undefined (reading 'config')

If I remove globals.css & Home.module.css files from index.tsx and _app.tsx I can run it as usual.

Expected Behavior

npm run dev should work

To Reproduce

Create a project with npx create-next-app@latest --ts

and run npm run dev

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
indahudcommented, Jan 20, 2022

@balazsorban44 I think there was some issue with Linux machine. It’s working perfectly on different machine.

1reaction
balazsorban44commented, Jan 6, 2022

@iota-unum seems to be unrelated. The default template doesn’t use Tailwind, you added something else. Here is a Tailwind starter https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss

@indahud could you try to reproduce it on a different machine? If you cannot, it’s something specific with your setup and not an issue with Next.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack not loading css - Stack Overflow
I am trying to load my PostCSS files with Webpack, using the ExtractTextPlugin to generate a css file into "dist". The problem is...
Read more >
How to configure CSS and CSS modules in webpack
One of the first thing you need to configure in your webpack project is CSS. CSS is so fundamental to a web app...
Read more >
css-loader | webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
How to configure CSS Modules for webpack - LogRocket Blog
Increase the flexibility of your app's CSS components with CSS Modules and Webpack in this handy tutorial and demo app build.
Read more >
Loading Styles - SurviveJS
Webpack doesn't handle styling out of the box, and you will have to use loaders and plugins to allow loading style files. In...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found