reactjswebpacksingle-page-applicationmulti-page-application

Is it possible to replicate multipage application with webpack without involving backend?


I need to split my application into 2 different parts, lets say simple app and main app. Simple app is in pure javascript without any dependencies, and main app is a react application. They both should be available under the same domain with different paths, like ${domain}/simple and ${domain}/main . Is this possible to accomplish with webpack?


Solution

  • Yes according to their docs this is how you do it

    // webpack.config.js
    module.exports = {
      entry: {
        pageOne: './src/pageOne/index.js',
        pageTwo: './src/pageTwo/index.js',
        pageThree: './src/pageThree/index.js',
      },
    };
    

    Just created a repo with a working example, if you want to take a better look how to implement it,
    here you go https://github.com/MattiSig/multipage-webpack