Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Fix DEV always being false in webpack #504

Merged
merged 1 commit into from
Aug 31, 2018
Merged

Fix DEV always being false in webpack #504

merged 1 commit into from
Aug 31, 2018

Conversation

marvinhagemeister
Copy link
Member

Found this while debugging why prop-types didn't work in preact-cli (see: preactjs/preact-cli#627).

Turns out the reason is that our global DEV variable was always set to false when preact-compat was bundled. The reason being that we checked if process is available:

const DEV = typeof process !== 'undefined' && process.env && process.env.NODE_ENV!=='production';

But bundlers typically don't shim the process object and instead replace all string occurrences of process.env.NODE_ENV with development for example. After the bundler has done its magic the code would now look like this:

const DEV = typeof process !== 'undefined' && process.env && 'development'!=='production';

Note that process is still undefined which is why DEV will always be false.

@developit developit merged commit 99bc934 into master Aug 31, 2018
@developit
Copy link
Member

released in 3.18.4!

@marvinhagemeister marvinhagemeister deleted the dev_always_false branch August 31, 2018 05:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants