juristr / webpack-typescript-starter

A simple Webpack 2 + TypeScript starter
126 stars 49 forks source link

Add common loader, such as raw-loader #3

Open juristr opened 7 years ago

juristr commented 7 years ago

Not sure whether to add this directly or just add like a docs folder where the configuration of such common loaders is described. Or better even, just point to the official webpack docs.

Remember, I'd like to keep the starter as lean as possible and only just add the most common ones.

Configuration of raw-loader

$ npm install raw-loader --save-dev
const path = require('path');
const webpack = require('webpack');

const ROOT = path.resolve( __dirname, 'src' );

module.exports = {
    module: {
        rules: [
            // Raw loader (for HTML for instance)
            {
                test: /\.html$/,
                loader: 'raw-loader',
                exclude: [ path.resolve( ROOT, 'index.html' ) ]
            }
        ]
    }
    ...
};