Просмотр исходного кода

improve initialization process for dev

Yuki Takei 3 лет назад
Родитель
Сommit
76e07ae34d
2 измененных файлов с 8 добавлено и 7 удалено
  1. 2 2
      packages/app/next.config.js
  2. 6 5
      packages/app/src/server/crowi/index.js

+ 2 - 2
packages/app/next.config.js

@@ -46,8 +46,8 @@ const setupTranspileModules = () => {
     ...listPrefixedPackages(['remark-', 'rehype-', 'hast-', 'mdast-', 'micromark-', 'unist-']),
   ];
 
-  logger.info('{bold:Listing scoped packages for transpiling:}');
-  logger.unprefixed('info', `{grey:${JSON.stringify(packages, null, 2)}}`);
+  // logger.info('{bold:Listing scoped packages for transpiling:}');
+  // logger.unprefixed('info', `{grey:${JSON.stringify(packages, null, 2)}}`);
 
   return require('next-transpile-modules')(packages);
 };

+ 6 - 5
packages/app/src/server/crowi/index.js

@@ -418,20 +418,21 @@ Crowi.prototype.getTokens = function() {
 
 Crowi.prototype.start = async function() {
   const dev = process.env.NODE_ENV !== 'production';
-  this.nextApp = next({ dev });
 
+  await this.init();
+  await this.buildServer();
+
+  // setup Next.js
+  this.nextApp = next({ dev });
   await this.nextApp.prepare();
 
-  // init CrowiDev
+  // setup CrowiDev
   if (dev) {
     const CrowiDev = require('./dev');
     this.crowiDev = new CrowiDev(this);
     this.crowiDev.init();
   }
 
-  await this.init();
-  await this.buildServer();
-
   const { express, configManager } = this;
 
   const app = (this.node_env === 'development') ? this.crowiDev.setupServer(express) : express;