When I am importing CSS file of react-toastify in my react.js component of React SSR Application it's throwing the following error in terminal.
.Toastify__toast-container {
^
SyntaxError: Unexpected token .
In my App.js I am importing it like this
import "react-toastify/dist/ReactToastify.css"
I am sharing my webpack configuration
var path = require("path");
var webpack = require("webpack");
var nodeExternals = require("webpack-node-externals");
var browserConfig = {
entry: "./src/browser/index.js",
mode: "none",
output: {
path: path.resolve(__dirname, "public"),
filename: "bundle.js",
publicPath: "/"
},
module: {
rules: [
{ test: /\.(js)$/, exclude: /node_modules/, use: ["babel-loader"] },
{
test: /\.(s?)css$/,
use: ["style-loader", "css-loader"]
}
]
},
plugins: [
new webpack.DefinePlugin({
__isBrowser__: "true"
})
]
};
var serverConfig = {
entry: "./src/server/index.js",
mode: "none",
target: "node",
externals: [nodeExternals()],
output: {
path: path.resolve(__dirname),
filename: "server.js",
publicPath: "/"
},
module: {
rules: [
{ test: /\.(js)$/, exclude: /node_modules/, use: ["babel-loader"] },
{
test: /\.(s?)css$/,
use: ["style-loader", "css-loader"]
}
]
},
plugins: [
new webpack.DefinePlugin({
__isBrowser__: "false"
})
]
};
module.exports = [browserConfig, serverConfig];
Any help will be appreciated.