Skip to content

Commit

Permalink
fix: consider custom devServer config (#10492)
Browse files Browse the repository at this point in the history
I麓m using a custom Docker setup and had trouble to get the watch-admin running. After some testing i found a few things. 

I had to first add the url to the config and second add the devServer config.

webpack: (config, webpack) => {
      config.devServer = {
            host: '0.0.0.0',
            useLocalIp: false
    };
    return config;
},

After that strapi develop --watch-admin was accessible over the docker ip. But because the config gets not forwarded in the opts, the hot reload doesn't work. 
That's because this doesn't get the args that i setup.

function createDomain(options, server) {
  const protocol = options.https ? 'https' : 'http';
  const hostname = options.useLocalIp
    ? ip.v4.sync() || 'localhost'
    : options.host || 'localhost';

If there is a another way I would like to know. Otherwise I would appreciate this small hotfix.  

Here my original problem -> https://stackoverflow.com/questions/8925820/javascript-object-push-function
  • Loading branch information
graphicfox committed Aug 4, 2021
1 parent 2cb527c commit 7b48705
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/strapi-admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ async function watchAdmin({ dir, host, port, browser, options }) {
options,
};

const webpackConfig = getCustomWebpackConfig(dir, args);
const opts = {
clientLogLevel: 'silent',
quiet: true,
Expand All @@ -259,9 +260,9 @@ async function watchAdmin({ dir, host, port, browser, options }) {
index: options.publicPath,
disableDotRule: true,
},
...webpack(webpackConfig).options.devServer
};

const webpackConfig = getCustomWebpackConfig(dir, args);
const server = new WebpackDevServer(webpack(webpackConfig), opts);

server.listen(port, host, function(err) {
Expand Down

0 comments on commit 7b48705

Please sign in to comment.