Authored by 陈峰

commit

... ... @@ -67,7 +67,7 @@ exports.devServer = (app, cb) => {
if (stats.errors.length) {
return;
}
clientManifest = JSON.parse(_readFile(devMiddleware.fileSystem, `yoho-ssr-client-${pkg.version}.json`));
clientManifest = JSON.parse(_readFile(devMiddleware.fileSystem, '../../manifest.json'));
if (bundle) {
ready({bundle, options: {clientManifest}});
... ... @@ -89,7 +89,7 @@ exports.devServer = (app, cb) => {
if (stats.errors.length) {
return;
}
bundle = JSON.parse(_readFile(mfs, `yoho-ssr-server-${pkg.version}.json`));
bundle = JSON.parse(_readFile(mfs, '../../manifest.server.json'));
if (clientManifest) {
ready({bundle, options: {clientManifest}});
... ...
const shelljs = require('shelljs');
const path = require('path');
const pkg = require('../package.json');
const distDir = path.join(__dirname, '../dist/node');
... ... @@ -20,8 +19,8 @@ const cpPaths = [
'doraemon',
'utils',
'apps/index.html',
`dist/yoho-ssr-client-${pkg.version}.json`,
`dist/yoho-ssr-server-${pkg.version}.json`
'dist/manifest.json',
'dist/manifest.server.json'
];
new Promise(resolve => { // 加载manifest.json文件
... ... @@ -42,12 +41,12 @@ new Promise(resolve => { // 加载manifest.json文件
shelljs.cp('-R', path.join(__dirname, '../', file), dist);
});
}).then(() => { // 验证文件正确性
if (!shelljs.test('-e', path.join(distDir, `yoho-ssr-client-${pkg.version}.json`))) {
console.error('error:check yoho-ssr-client.json faild');
if (!shelljs.test('-e', path.join(distDir, 'manifest.json'))) {
console.error('error:check manifest.json faild');
return process.exit(1); //eslint-disable-line
}
if (!shelljs.test('-e', path.join(distDir, `yoho-ssr-server-${pkg.version}.json`))) {
console.error('error:check yoho-ssr-server.json faild');
if (!shelljs.test('-e', path.join(distDir, 'manifest.server.json'))) {
console.error('error:check manifest.server.json faild');
return process.exit(1); //eslint-disable-line
}
}).then(() => { // 安装依赖和清理node_modules
... ...
... ... @@ -4,7 +4,6 @@ const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin');
const pkg = require('../package.json');
let baseConfig = require('./webpack.base.conf');
const isProd = process.env.NODE_ENV === 'production';
... ... @@ -100,7 +99,7 @@ const webpackConfig = merge(baseConfig, {
},
plugins: [
new VueSSRClientPlugin({
filename: `../../yoho-ssr-client-${pkg.version}.json`
filename: '../../manifest.json'
}),
new webpack.DefinePlugin({
'process.env.VUE_ENV': '"client"'
... ...
... ... @@ -42,7 +42,7 @@ let webpackConfig = merge(baseConfig, {
}),
plugins: [
new VueSSRServerPlugin({
filename: `../../yoho-ssr-server-${pkg.version}.json`
filename: '../../manifest.server.json'
}),
new webpack.DefinePlugin({
'process.env.VUE_ENV': '"server"'
... ...
... ... @@ -20,8 +20,8 @@ let serverBundle;
if (!isDev) {
const template = fs.readFileSync(path.join(__dirname, '../../index.html'), 'utf-8');
serverBundle = require(`../../yoho-ssr-server-${pkg.version}.json`);
const clientManifest = require(`../../yoho-ssr-client-${pkg.version}.json`);
serverBundle = require('../../manifest.server.json');
const clientManifest = require('../../manifest.json');
renderer = createBundleRenderer(serverBundle, {
runInNewContext: false,
... ...