1

Presently, I am using HtmlWebpackPlugin and hot reload for development to generate an html file that includes the javascript bundle.

This works fine with the following webpack configuration:

const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const path = require('path')
const { NoErrorsPlugin, HotModuleReplacementPlugin } = webpack;
const { OccurrenceOrderPlugin } = webpack.optimize;

module.exports = {
    entry : {
        app: [
            'webpack-hot-middleware/client',
            './src/index.tsx',
        ],
    },  
    output: {
        filename: "bundle.js",
        path: path.join(__dirname, 'build'),
        publicPath: '/static/'
    },

    devtool: "eval",

    resolve: {
        // Add '.ts' and '.tsx' as resolvable extensions.
        extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
    },

    module: {
        loaders: [
            // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
            { test: /\.tsx?$/, loaders: ['react-hot-loader', 'awesome-typescript-loader'] }
        ],

        preLoaders: [
            // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
            { test: /\.js$/, loader: "source-map-loader" }
        ]
    },

    plugins: [
        new OccurrenceOrderPlugin(),
        new HotModuleReplacementPlugin(),
        new NoErrorsPlugin(),
        new HtmlWebpackPlugin({
            filename: 'index.html',
            template: 'src/templates/index.ejs',
            minify: false,
            excludeChunks: ['static'],
        }),
    ],
};

However, it does not include the blueprintjs stylesheet. How should I configure that? I tried less-loader but it did not import anything.

Svetlin Ralchev
  • 614
  • 6
  • 5

1 Answers1

1

You can import your less file in ts file and use less-loader in webpack configuration

wuxiandiejia
  • 851
  • 1
  • 10
  • 15