mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 11:54:10 +00:00 
			
		
		
		
	
							parent
							
								
									079a24e1be
								
							
						
					
					
						commit
						7bf9f819e0
					
				@ -29,6 +29,11 @@ function getCustomWebpackConfig(dir, config) {
 | 
				
			|||||||
    const webpackAdminConfig = require(path.resolve(adminConfigPath));
 | 
					    const webpackAdminConfig = require(path.resolve(adminConfigPath));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (_.isFunction(webpackAdminConfig)) {
 | 
					    if (_.isFunction(webpackAdminConfig)) {
 | 
				
			||||||
 | 
					      // Expose the devServer configuration
 | 
				
			||||||
 | 
					      if (config.devServer) {
 | 
				
			||||||
 | 
					        webpackConfig.devServer = config.devServer;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      webpackConfig = webpackAdminConfig(webpackConfig, webpack);
 | 
					      webpackConfig = webpackAdminConfig(webpackConfig, webpack);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (!webpackConfig) {
 | 
					      if (!webpackConfig) {
 | 
				
			||||||
@ -232,10 +237,8 @@ async function watchAdmin({ plugins, dir, host, port, browser, options }) {
 | 
				
			|||||||
    port,
 | 
					    port,
 | 
				
			||||||
    options,
 | 
					    options,
 | 
				
			||||||
    roots,
 | 
					    roots,
 | 
				
			||||||
  };
 | 
					    devServer: {
 | 
				
			||||||
 | 
					      port,
 | 
				
			||||||
  const webpackConfig = getCustomWebpackConfig(dir, args);
 | 
					 | 
				
			||||||
  const opts = {
 | 
					 | 
				
			||||||
      client: {
 | 
					      client: {
 | 
				
			||||||
        logging: 'none',
 | 
					        logging: 'none',
 | 
				
			||||||
        overlay: {
 | 
					        overlay: {
 | 
				
			||||||
@ -252,21 +255,24 @@ async function watchAdmin({ plugins, dir, host, port, browser, options }) {
 | 
				
			|||||||
        index: options.adminPath,
 | 
					        index: options.adminPath,
 | 
				
			||||||
        disableDotRule: true,
 | 
					        disableDotRule: true,
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    ...webpack(webpackConfig).options.devServer,
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const server = new WebpackDevServer(opts, webpack(webpackConfig));
 | 
					  const webpackConfig = getCustomWebpackConfig(dir, args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  server.start(port, host, function(err) {
 | 
					  const compiler = webpack(webpackConfig);
 | 
				
			||||||
    if (err) {
 | 
					 | 
				
			||||||
      console.log(err);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const server = new WebpackDevServer(compiler.options.devServer, compiler);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const runServer = async () => {
 | 
				
			||||||
    console.log(chalk.green('Starting the development server...'));
 | 
					    console.log(chalk.green('Starting the development server...'));
 | 
				
			||||||
    console.log();
 | 
					    console.log();
 | 
				
			||||||
    console.log(chalk.green(`Admin development at http://${host}:${port}${options.adminPath}`));
 | 
					    console.log(chalk.green(`Admin development at http://${host}:${port}${options.adminPath}`));
 | 
				
			||||||
  });
 | 
					
 | 
				
			||||||
 | 
					    await server.start();
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  runServer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  watchFiles(dir);
 | 
					  watchFiles(dir);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user