Re: [pgAdmin4][Patch]: Run MakeFile to generate builds in production mode

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: Run MakeFile to generate builds in production mode
Date: 2017-09-13 14:50:50
Message-ID: CA+OCxoxrePvRq=Rc21zEinzbQuK-R_EKvYAr1yFFzruQjC=yWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Thanks, applied.

On Wed, Sep 13, 2017 at 1:26 PM, Surinder Kumar <
surinder(dot)kumar(at)enterprisedb(dot)com> wrote:

> Hi Dave,
>
> If we set 'NODE_ENV' to 'production' variable in definePlugin, the React
> will always build in production mode.
>
> Please find an attached patch.
>
> Thanks,
> Surinder
>
>
>
> On Wed, Sep 13, 2017 at 4:36 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>>
>>
>> On Wed, Sep 13, 2017 at 10:34 AM, Surinder Kumar <
>> surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
>>
>>> On Wed, Sep 13, 2017 at 2:52 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>
>>>>
>>>>
>>>> On Wed, Sep 13, 2017 at 10:06 AM, Surinder Kumar <
>>>> surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
>>>>
>>>>>
>>>>> ​
>>>>> On Wed, Sep 13, 2017 at 2:18 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>>>
>>>>>> Thanks, committed - though I did add a bundle-dev target to the
>>>>>> Makefile for convenience.
>>>>>>
>>>>>> I'm a little concerned though that the query history still doesn't
>>>>>> work in dev mode. Is that fixable?
>>>>>>
>>>>> ​That's an issue with ReactJS and I had logged a ticket​
>>>>>
>>>>> ​on their repository but didn't get any response from them.
>>>>> The solution is pass `production` flag in place of `envType` in `dev`
>>>>> mode too.
>>>>>
>>>>> const definePlugin = new webpack.DefinePlugin({
>>>>> ​ ​
>>>>> 'process.env': {
>>>>> ​ ​
>>>>> 'NODE_ENV': JSON.stringify(envType),
>>>>> ​ // In dev mode envType is `development`​
>>>>>
>>>>> ​ ​
>>>>> },
>>>>> });
>>>>>
>>>>
>>>> What would be the effect of that? No source map being generated for
>>>> React?
>>>>
>>> ​Only React is using definePlugin's '
>>> NODE_ENV'
>>> ​ variable​
>>> for writing debug-only statements in React code.
>>> ​ It will have no effect on functionality. It is used to reduce React
>>> bundle size by eliminating debug-only code when run in `production` mode.
>>>
>>> React code is like:
>>>
>>> function implementSomeReactBehavior() {
>>> // do actual work part 1
>>>
>>> if(process.env.NODE_ENV !== "production") {
>>> // do debug-only work, like recording perf stats
>>> }
>>>
>>> // do actual work part 2
>>> }
>>>
>>>
>>> We are not generating source maps for vendor libraries including React.
>>> We generate source maps for pgAdmin4 modules only for debugging purpose.
>>>
>>
>> OK, in that case can you please tweak our build so React is always in
>> prod mode, regardless of everything else? We really shouldn't have things
>> that only work in one mode.
>>
>> Thanks!
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2017-09-13 15:01:19 pgAdmin 4 commit: Bundle fonts with pgAdmin so we have a standard set f
Previous Message Dave Page 2017-09-13 14:50:45 pgAdmin 4 commit: Always pack React in prod mode to avoid a bug in debu