Skip to content

Commit

Permalink
chore: update ssr-with-rax
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Apr 3, 2020
1 parent 6ab5e94 commit 563af51
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
16 changes: 5 additions & 11 deletions example/ssr-with-rax/build/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const webpackModule = {
},
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
// exclude: /node_modules/,
exclude: /node_modules/,
loader: require.resolve('babel-loader'),
options: {
cacheDirectory: true,
Expand All @@ -33,16 +33,10 @@ const webpackModule = {
{
modules: false
}
]
],
plugins: [
'babel-plugin-transform-jsx-to-html',
[
require.resolve('@babel/plugin-transform-react-jsx'),
{
pragma: 'createElement'
}
]
],
['@babel/preset-react', {
'pragma': 'createElement'
}]
]
}
},
Expand Down
34 changes: 34 additions & 0 deletions example/ssr-with-rax/build/webpack.config.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,46 @@ const plugins = [
'__isBrowser__': false //eslint-disable-line
})
]
const webpackModule = {
strictExportPresence: true,
rules: [
{ parser: { requireEnsure: false } },
{
oneOf: [
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
exclude: /node_modules/,
loader: require.resolve('babel-loader'),
options: {
cacheDirectory: true,
cacheCompression: false,
presets: [
[
require.resolve('@babel/preset-env'),
{
modules: false
}
],
['@babel/preset-react', {
'pragma': 'createElement'
}]
],
plugins: [
'babel-plugin-transform-jsx-to-html'
]
}
}
]
}
]
}
module.exports = merge(baseConfig, {
devtool: isDev ? 'eval-source-map' : '',
entry: {
Page: paths.entry,
Layout: paths.layout
},
module: webpackModule,
target: 'node',
externals: nodeExternals({
whitelist: /\.(css|less|sass|scss)$|^rax-+/
Expand Down
2 changes: 1 addition & 1 deletion example/ssr-with-rax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
],
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-transform-react-jsx": "^7.8.3",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.9.4",
"babel-loader": "8.0.4",
"babel-plugin-transform-jsx-to-html": "^0.2.0",
"browserslist": "^4.6.3",
Expand Down

0 comments on commit 563af51

Please sign in to comment.