A loader is a webpack extension that transforms a particular type of module content so it can be included in the bundle. Webpack follows application dependencies and selects loaders from configured module rules. section 16.3
Configure loaders by matching files and assigning processing packages:
- Use ts-loader for .ts files; it compiles TypeScript and feeds the resulting code into webpack's bundle. section 16.3
- Use css-loader and style-loader together for CSS; the first handles CSS module content and the second incorporates the styles into the bundle. section 16.6.1
Adding Bootstrap CSS
Install Bootstrap with css-loader and style-loader, then add { test: /\.css$/, use: ["style-loader", "css-loader"] } to webpack.config.js. Import "bootstrap/dist/css/bootstrap.css" from src/index.ts; webpack can then include the stylesheet in bundle.js alongside the application code.
