lumenwrites / django-react-blog

Simple blog built with Django and React/Redux, deployed with Docker, and served with nginx/uwsgi.
http://digitalmind.io
MIT License
563 stars 95 forks source link

Use development/production NODE_ENV #4

Closed helb closed 7 years ago

helb commented 7 years ago

I get this warning on digitalmind.io (both Chrome and FF):

magpie_20170314_155423

There are probably two problems:

I use something like this to minify code only in production builds:

function getPlugins() {
    const plugins = [];

    if (process.env.NODE_ENV === "production") {
        plugins.push(new webpack.optimize.UglifyJsPlugin({
            minimize: true,
            output: {
                comments: false
            },
            compressor: {
                warnings: false
            }
        }));
    } else {
        // not related to this issue,
        // but quite useful, too :)
        plugins.push(new webpack.HotModuleReplacementPlugin());
    }

    return plugins;
}

module.exports = {
    …
    plugins: getPlugins(),
    …
}
lumenwrites commented 7 years ago

Oh, this is awesome! To be honest, I don't entirely understand how webpack works yet, but I've added your code and the error is gone =)

Thank you very much for your help!