Problem reading CSS files with webpack
See original GitHub issueWhat 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:
- Created 2 years ago
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@balazsorban44 I think there was some issue with Linux machine. It’s working perfectly on different machine.
@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