Updated to Apollo Client 3.4 and built code won't run because of __DEV__

Hi,

I’ve just updated to 3.4.0. Running in dev is working fine.

When I build my project and run it on the server, I get the following:


which points to:

if (!node.object) {
                        var obj_1 = node.object = Object.create(proto_1);
                        this.known.add(obj_1);
                        keys.sorted.forEach(function (key, i) {
                            obj_1[key] = array_1[firstValueIndex_1 + i];
                        });
                        if (__DEV__) {
                            Object.freeze(obj_1);
                        }
                    }

Do I need to be setting something to stop this from happening? I saw the release notes for 3.4 saying they’re changing it from NODE_ENV to DEV but this change shouldn’t make a difference.

Any ideas?

Note: If I hack my app.js file and add var __DEV__ = false; at the top, everything works as expected so I assume I’m missing something with setting this option to false. I also assume I shouldn’t have to set up any minification options to replace this with false myself, should I? Seems like a strange requirement.

@webnoob This should have been fixed by Delay initializing `stringifyCanon` until `canonicalStringify` used. by benjamn · Pull Request #8558 · apollographql/apollo-client · GitHub, which is available now in @apollo/client@3.4.1 or later. Try npm i @apollo/client@latest?

3 Likes

Awesome - thanks. Will check it out tomorrow.