Home > Net >  writeToDisk with create-react-app not displaying work files
writeToDisk with create-react-app not displaying work files

Time:05-12

I am trying to configure webpack in my react app so that during development, the files are visible in the dist folder (or wherever).

So I tried react-app-rewired with the following config

module.exports = function override(config, env) {
    config.devServer = {
        devMiddleware: {
            writeToDisk: true
        }
    }
    return config;
}

But it doesn't seem to work. I've been looking for how to make writeToDisk work, and it seems to have changed at some point, because I can't find anything online that works.

How can I get writeToDisk to work so that it writes the hot-reload files to a visible folder when running react-scripts start?

CodePudding user response:

I just ended up going with craco instead, which worked.

craco.config.js:

module.exports = {
    devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => {
        devServerConfig.devMiddleware.writeToDisk = true;
        return devServerConfig;
    },
};
  • Related