opened
dimaqq
username_0
I'm using:
* styled-components@5.1.1 with `pure: true`
* import them `from "styled-components/macro"`
* in a create-react-app app
* targeting only evergreen browsers

Building the app, I find this in `2.<hash>.chunk.js`:

```js
            var b = "undefined" !== typeof e && (Object({
                    NODE_ENV: "production",
                    PUBLIC_URL: "",
                    WDS_SOCKET_HOST: void 0,
                    WDS_SOCKET_PATH: void 0,
                    WDS_SOCKET_PORT: void 0,
                    REACT_APP_GIT_SHA: "d317dc12351f14768f919735d4486a651224f448"
                }).REACT_APP_SC_ATTR || Object({
                    NODE_ENV: "production",
                    PUBLIC_URL: "",
                    WDS_SOCKET_HOST: void 0,
                    WDS_SOCKET_PATH: void 0,
                    WDS_SOCKET_PORT: void 0,
                    REACT_APP_GIT_SHA: "d317dc12351f14768f919735d4486a651224f448"
                }).SC_ATTR) || "data-styled",
                w = "undefined" !== typeof window && "HTMLElement" in
                window,
                _ = "boolean" === typeof SC_DISABLE_SPEEDY &&
                SC_DISABLE_SPEEDY || "undefined" !== typeof e && (
                    Object({
                        NODE_ENV: "production",
                        PUBLIC_URL: "",
                        WDS_SOCKET_HOST: void 0,
                        WDS_SOCKET_PATH: void 0,
                        WDS_SOCKET_PORT: void 0,
                        REACT_APP_GIT_SHA: "d317dc12351f14768f919735d4486a651224f448"
                    }).REACT_APP_SC_DISABLE_SPEEDY || Object({
                        NODE_ENV: "production",
                        PUBLIC_URL: "",
                        WDS_SOCKET_HOST: void 0,
                        WDS_SOCKET_PATH: void 0,
                        WDS_SOCKET_PORT: void 0,
                        REACT_APP_GIT_SHA: "d317dc12351f14768f919735d4486a651224f448"
                    }).SC_DISABLE_SPEEDY) || !1,
```

Would it be possible not to include the entire (?) environment in the build?

I was trying to set up `REACT_APP_GIT_SHA` env var and use it **very carefully** so that most of the build artefacts are not changed. Here, `styled-components` thwarted my attempts.

I think, if someone needs to inject a `REACT_APP_SECRET_VALUE` they'd have the same problem.
Is it possible not to pull env vars into build?
issue
closed
probablyup
username_1
issue
created
probablyup
username_1
Whatever that is isn't coming from our codebase
comment
created
dimaqq
username_0
Hmm I was rather certain that `SC_` variables were for styled-components.
There's even a test in this codebase for correct treatment of `REACT_APP_SC_DISABLE_SPEEDY`:
https://github.com/styled-components/styled-components/blob/147b0e9a1f10786551b13fd27452fcd5c678d5e0/packages/styled-components/src/test/constants.test.js#L117-L122
comment
created
dimaqq
username_0
```
node_modules/styled-components/primitives/dist/styled-components-primitives.esm.js
154:var DISABLE_SPEEDY = typeof SC_DISABLE_SPEEDY === 'boolean' && SC_DISABLE_SPEEDY || typeof process !== 'undefined' && (process.env.REACT_APP_SC_DISABLE_SPEEDY || process.env.SC_DISABLE_SPEEDY) || process.env.NODE_ENV !== 'production'; // Shared empty execution context when generating static styles
```
comment
created
dimaqq
username_0
My best guess is that merely referencing `process.env.REACT_APP_xxx` tricks CRA/webpack into including the entire "visible" part of env. 🤔
comment
created
dimaqq
username_0
So, ugh, is there perhaps some other way to let users control "disable speedy" than through env?
comment