Skip to content

Commit

Permalink
Merge pull request #2279 from Sefaria/fix-webpack-config-autoload-rea…
Browse files Browse the repository at this point in the history
…ct-ssr

Attempt to fix React Undefined in SSR
  • Loading branch information
akiva10b authored Jan 27, 2025
2 parents 846df25 + 1f4a9b2 commit e12c02f
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions node/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,29 @@ var baseConfig = {
],
module: {
rules: [
//a regexp that tells webpack use the following loaders on all
//.js and .jsx files
{
test: /\.jsx?$/,
//we definitely don't want babel to transpile all the files in
//node_modules. That would take a long time.
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
//specify that we will be dealing with React code
presets: ['@babel/react', '@babel/preset-env'],
plugins: ['@babel/plugin-transform-destructuring', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-async-to-generator']
}
}
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/react', { runtime: 'automatic' }],
'@babel/preset-env'
],
plugins: [
'@babel/plugin-transform-destructuring',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-async-to-generator'
]
}
]
}
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
}
]
},
externals: {
react: 'React',
Expand Down

0 comments on commit e12c02f

Please sign in to comment.