在更新的代码中实现服务器端渲染。

作者: arindampradhan创建于 2018年2月7日更新于 2018年2月7日

// JavaScript // ------------------------------------ config.module.rules.push({ test: /.(js|jsx)$/, exclude: /node_modules/, use: [{ loader: 'babel-loader', query: { cacheDirectory: true, plugins: [ 'babel-plugin-transform-class-properties', 'babel-plugin-syntax-dynamic-import', [ 'babel-plugin-transform-runtime', { helpers: true, polyfill: false, // we polyfill needed features in src/normalize.js regenerator: true, }, ], [ 'babel-plugin-transform-object-rest-spread', { useBuiltIns: true // we polyfill Object.assign in src/normalize.js }, ], ], presets: [ 'babel-preset-react', ['babel-preset-env', { modules: false, targets: { ie9: true, }, uglify: true, }], ] }, }], })

// Server config.module.rules.push({ test: /.(ttf|eot|svg|woff(2)?)(\S+)?$/, // test:

内容来源: dvdzkwsk/react-redux-starter-kit