Not work only server side render
See original GitHub issueHere is minimun reproduction
I only config webpack for server compile:
const path = require('path')
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, 'src/index.jsx'),
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.js'
},
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx', '.less', '.css']
},
target: 'node',
module: {
rules: [
{
test: /\.less$/,
use: [
'isomorphic-style-loader',
{
loader: 'css-loader',
options: {
onlyLocals: true,
localsConvention: 'camelCase',
importLoaders: 1,
modules: {
localIdentName: '[path][name]__[local]'
}
}
},
// 'css-loader',
{
loader: 'less-loader',
options: {
sourceMap: true,
relative: true
}
}
]
},
{
test: /\.jsx?$/,
use: ["babel-loader"]
}
]
}
}
and get this:
I found a similar issue, but there is not a clear anwser ~
Did I missing something ?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Why Server-Side Rendering Alone Is Not the Solution
Speeding Up Load Times With Server-Side Rendering ... Of course, caching is only a solution for content that does not contain user data....
Read more >Server-side rendering not working on production Next.js
getServerSideProps only works in page components. Does this answer your question: NEXTJS: getServerSideProps not working into components?
Read more >How to Disable Server-Side Rendering (SSR) in Next.js
Step 1: Rewrite All Requests to pages/index.js · Step 2: Disable SSR for Page Content · Step 3: Check that Everything Works with...
Read more >Server-side rendering - Apollo GraphQL Docs
Server -side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw...
Read more >React Server Components. - It's not server-side rendering.
Whereas SSR is only used once for the initial rendering, Server Components can be re-fetched multiple times to re-render the data (in the...
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
Thanks @lfscheidegger i had same issue and after adding esModule:false is working now
here is my webpack.server.js file
Happy Coding : )
I ran into a similar problem, and I found a workaround for my case - maybe it’ll work for other people too.
TL;DR - if you’re using webpack4, set the
esModule
option incss-loader
tofalse
.I’m no expert here by any means, but here’s how I debugged this: I had my
insertCss
function print out thecss
values it was getting (which ultimately come from webpack when you call something likeimport css from './styles.css'
). In my case I usesass-loader
, but I actually think that’s irrelevant here.In an old version of my project (which used webpack3 and isomorphic-style-loader 4), the output of printing those modules was an object with
_getContent
,_setCss
, and_insertCss
. This is expected, from looking at https://github.com/kriasoft/isomorphic-style-loader/blob/master/src/index.js#L26.However, the object printed in the old build also included the non-module -> module mapping for all the css classes. And crucially, those keys (which come from https://github.com/kriasoft/isomorphic-style-loader/blob/master/src/index.js#L25) seem to be missing when this issue reproduces.
I then monkey-patched the installed isomorphic-style-loader (I’m on 5.1.0) to print out
css.locals
, and as suspected, that’s alwaysundefined
.This made me suspect that the issue wasn’t directly with isomorphic-style-loader, but with whatever changed in
css-loader
between webpack3 and webpack4. I more or less guessed at some options until I verified that settingesModule: false
in thecss-loader
options seems to bring back the old behavior.Worked for me, but YMMV!