How to load an external config file in a Webpack-React application without bundling it?

后端 未结 2 1203
攒了一身酷
攒了一身酷 2020-12-19 00:37

I have a web application that is written with React and bundled with Webpack. The application has a JSON config file that I want to include at runtime and not to be bundled

2条回答
  •  梦毁少年i
    2020-12-19 01:29

    I ended up using a modified version of that to load my script externally. My application doesn't require the config immediately so the async aspect doesn't make a difference here.

    I placed this at the top of my in applications entry page with a co-located config file.

    
        ... other scripts
        
    
    
        

提交回复
热议问题