Skip to content

Commit

Permalink
fix: fix document
Browse files Browse the repository at this point in the history
  • Loading branch information
Orange-C committed Aug 1, 2019
1 parent fba5ee1 commit 9277be0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
3 changes: 3 additions & 0 deletions packages/rax-plugin-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"chalk": "^2.4.2",
"deepmerge": "^4.0.0",
"fs-extra": "^8.1.0",
"lodash.clone": "^4.5.0",
"lodash.clonedeep": "^4.5.0",
"rax-pwa-webpack-plugin": "^1.0.0-0",
"rax-ssr-dev-server": "^1.0.0",
"webpack": "^4.38.0"
}
}
10 changes: 6 additions & 4 deletions packages/rax-plugin-ssr/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const clone = require('lodash.clonedeep');
// const clone = require('lodash.clonedeep');
const clone = require('lodash.clone');

const setSSRBase = require('./setSSRBase');
const setSSRBuild = require('./setSSRBuild');
Expand All @@ -10,12 +11,13 @@ const runSSRDev = require('./runSSRDev');
module.exports = ({ chainWebpack, registerConfig, rootDir, onHook, log }) => {
chainWebpack((config, { command }) => {
const webConfig = config.get('web');
const ssrConfig = clone(config.get('web'));
// const ssrConfig = clone(config.get('web'));
const ssrConfig = webConfig;

registerConfig('ssr', ssrConfig);
// registerConfig('ssr', ssrConfig);

setSSRBase(ssrConfig, rootDir);
setWebBase(webConfig, rootDir);
// setWebBase(webConfig, rootDir);

if (command === 'build') {
setSSRBuild(ssrConfig);
Expand Down
6 changes: 4 additions & 2 deletions packages/rax-plugin-ssr/src/setSSRBase.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict';

const { getEntries } = require('./getEntries');
const getEntries = require('./getEntries');

module.exports = (config, rootDir) => {
const entries = getEntries(rootDir);

config.entryPoints.clear();

Object.keys(entries).forEach((key) => {
config.entry(key)
.add(entries[key]);
Expand All @@ -26,7 +28,7 @@ module.exports = (config, rootDir) => {
rax: 'rax',
});

config.plugin('document').clear();
config.plugins.delete('document');

return config;
};
4 changes: 2 additions & 2 deletions packages/rax-plugin-ssr/src/setWebBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const path = require('path');
const AssetsManifestPlugin = require('rax-pwa-webpack-plugin/lib/AssetsManifestPlugin').default;
const { RaxPWAPlugin } = require('rax-pwa-webpack-plugin');

const { getEntries } = require('./getEntries');
const getEntries = require('./getEntries');

module.exports = (config, rootDir) => {
const entries = getEntries(rootDir);

config.entry.clear();
config.entryPoints.clear();

Object.keys(entries).forEach((key) => {
config.entry(key)
Expand Down
3 changes: 2 additions & 1 deletion packages/raxappTest/build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"plugins": [
["rax-plugin-app", { "targets": ["web"]}]
["rax-plugin-app", { "targets": ["web"]}],
"rax-plugin-ssr"
]
}
3 changes: 3 additions & 0 deletions packages/raxappTest/link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cd ../rax-plugin-app
npm link ../raxappTest/node_modules/rax
npm link ../universal-app-shell-loader

cd ../rax-plugin-ssr
npm link ../raxappTest/node_modules/rax

cd ../universal-app-runtime
npm link ../raxappTest/node_modules/rax

Expand Down

0 comments on commit 9277be0

Please sign in to comment.