mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +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,41 +237,42 @@ async function watchAdmin({ plugins, dir, host, port, browser, options }) {
|
|||||||
port,
|
port,
|
||||||
options,
|
options,
|
||||||
roots,
|
roots,
|
||||||
|
devServer: {
|
||||||
|
port,
|
||||||
|
client: {
|
||||||
|
logging: 'none',
|
||||||
|
overlay: {
|
||||||
|
errors: true,
|
||||||
|
warnings: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
open: browser === 'true' ? true : browser,
|
||||||
|
devMiddleware: {
|
||||||
|
publicPath: options.adminPath,
|
||||||
|
},
|
||||||
|
historyApiFallback: {
|
||||||
|
index: options.adminPath,
|
||||||
|
disableDotRule: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const webpackConfig = getCustomWebpackConfig(dir, args);
|
const webpackConfig = getCustomWebpackConfig(dir, args);
|
||||||
const opts = {
|
|
||||||
client: {
|
|
||||||
logging: 'none',
|
|
||||||
overlay: {
|
|
||||||
errors: true,
|
|
||||||
warnings: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
open: browser === 'true' ? true : browser,
|
const compiler = webpack(webpackConfig);
|
||||||
devMiddleware: {
|
|
||||||
publicPath: options.adminPath,
|
|
||||||
},
|
|
||||||
historyApiFallback: {
|
|
||||||
index: options.adminPath,
|
|
||||||
disableDotRule: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
...webpack(webpackConfig).options.devServer,
|
const server = new WebpackDevServer(compiler.options.devServer, compiler);
|
||||||
};
|
|
||||||
|
|
||||||
const server = new WebpackDevServer(opts, webpack(webpackConfig));
|
|
||||||
|
|
||||||
server.start(port, host, function(err) {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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