Skip to content

faucet-pipeline-js(x) does not replace process.env.NODE_ENV when bundling an React app #144

@ngrewe

Description

@ngrewe

Hey folks,

Having spent countless hours crafting webpack configurations, I find the concept of faucet quite appealing and am currently trying to bundle a simple React application. Unfortunately, I can't really wrap my head around how to do it. A reproducing repository of my problem can be found at ngrewe/faucet-pipeline-react.

If I run this through faucet with jsx and esnext set to true, I end up with a bundle that is unusable in the browser because it still contains commonJS require() calls. These calls are from code imported from within my node_modules folder, so it seems that rollup is not making any effort to pull them into the bundle correctly. Interestingly, if I add a require() call to my own code, that will be bundled properly. (I managed to solve this problem, see comment below)

I've also noticed that if I do not include esnext: true in the faucet configuration, all require()d modules are correctly bundled up, but then things trip up on the various places where React uses process.env.NODE_ENV, which remains present in the finished bundle. In the webpack world, that would automatically be defined away according to the --mode switch – how is Rollup/Faucet supposed to handle this? Any pointers would be greatly appreciated.

Thanks,

Niels

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions