Sumeet Roy
Sumeet Roy

Reputation: 140

Run React dev server inside another application

In our old .jsp application, we are integrating react.

My react dev server is running on http://localhost:3000 and existing application at http://localhost:8100.

I included all the required js & CSS files of reacting into JSP page. which is working fine.

When when I'm using lazy-loading in React, for ex:

import('some-file.js').then(file => {
   // Some work
});

In this case Webpack is trying to load chunk from localhost:8100 instead of Dev server.

I'm using react-script for development and build.

enter image description here

Upvotes: 1

Views: 252

Answers (1)

Pallamolla Sai
Pallamolla Sai

Reputation: 2493

Try to add publicPath like below in webconfig.js files.

output: {
        //
        publicPath: 'http://localhost:3000/static/js/dist' or
        // publicPath : 'http://localhost:3000/dist'
    }

Upvotes: 2

Related Questions