Usage with Nextjs
See original GitHub issueHi, thanks for creating this library! I was eager to try it with Nextjs, but faced some issues. I’m using Nextjs v 10.0.7 and latest vanilla-extract. I have this setup:
next.config.js:
const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.plugins.push(new VanillaExtractPlugin({
// allowRuntime: true
}));
config.plugins.push(new MiniCssExtractPlugin())
return config;
},
};
.babelrc:
{
"presets": ["next/babel"],
"plugins": [
"@vanilla-extract/babel-plugin"
]
}
When I try to run yarn dev
, I get:
Error: Cannot find module 'webpack/lib/NormalModule'
Require stack:
- /{projectpath}/node_modules/mini-css-extract-plugin/dist/index.js
- /{projectpath}/node_modules/mini-css-extract-plugin/dist/cjs.js
- /{projectpath}/next.config.js
Do you perhaps an idea how to solve this: Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
What is Next.js?
Next.js is a React framework that gives you building blocks to create web applications. By framework, we mean Next.js handles the tooling and...
Read more >Nextjs for everyone — with some basic knowledge of React
Next.js is a JavaScript framework created by Zeit. It lets you build server-side rendering and static web applications using React. It's a great ......
Read more >What is Next JS and Why Should You Use it in 2022? - Pagepro
Next.js is widely used by the biggest and most popular companies all over the world like Netflix, Uber, Starbucks, or Twitch. It's also ......
Read more >What is Next.js & Why & How To Use It in 2022? - Emizentech
No, Next.js is a framework primarily used for server-side rendering of react applications. Next.js provides a backend that can be used by server ......
Read more >Usage with Next.js - SWR
Together with SWR, you can pre-render the page for SEO, and also have features such as caching, revalidation, focus tracking, refetching on ...
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
I’ve got
vanilla-extract
working with Next.js with hot reload. This setup works but it showsYou did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js
warning..babelrc
next.config.js
Ah thanks, downgrading to
"@vanilla-extract/babel-plugin": "0.2.1"
resolves this issue 👍Update:
"@vanilla-extract/babel-plugin": "0.3.1"
now works as well