How to import bootstrap .js and .css files with Webpack?

To import bootstrap .js and .css files with Webpack, we add it the paths to resolve the files into the Webpack config.

To do this, we write

module.exports = {
  resolve: {
    alias: {
      jquery: path.join(
        __dirname,
        "development/bower_components/jquery/jquery"
      ),
    },
    root: srcPath,
    extensions: ["", ".js", ".css"],
    modulesDirectories: [
      "node_modules",
      srcPath,
      commonStylePath,
      bootstrapPath,
    ],
  },
};

to make Webpack resolve the directories in the modulesDirectories array.

And we include the extensions of the files to resolve in the extensions array.