Из-за ssr, нужно поменять style-loader на mini-css-extract-plugin
Вот webpack config:
const path = require('path');
module.exports = {
mode: 'production',
entry: './src/index.ts',
target: 'node',
output: {
filename: "index.js",
path: path.resolve(__dirname, 'dist'),
libraryTarget: "umd",
clean: true,
globalObject: 'this',
},
resolve: {
extensions: ['.ts', '.tsx']
},
externals: {
react: 'react',
},
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
],
},
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
{
test: /\.(ts|tsx)?$/,
use: ['ts-loader'],
exclude: /node_modules/
}
]
}
}