Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
157 views
in Technique[技术] by (71.8m points)

javascript - Build different production builds of react app differing by part of implementation

I created my react app with create-react-app script. I would like to achieve possibility to build 2 different versions of react app which differs by, let's say, single function?

Let's consider 2 possible implementations of fetchSth() - one would do http GET to some backend, another would call WASM compiled version of backend bundled to module of fetchSth(). These 2 fetchSth() cant exist simultaneously so there cannot be some runtime check.

It sounds like there would be need some sort of changing dispatching in imports.

I would achieve that by juggling with symlinks, but is there less barbaric way to achieve this, by let's say defining some environmental variable or passing sth to npm build?

I use typescript version of react if it differs.

question from:https://stackoverflow.com/questions/65545406/build-different-production-builds-of-react-app-differing-by-part-of-implementati

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...