handlebars-loader icon indicating copy to clipboard operation
handlebars-loader copied to clipboard

Browser support

Open pbrain19 opened this issue 9 years ago • 4 comments

Currently switching from require js to webpack. I seem to have an issue with the way loads handlebars templates. It seems to be that the loader is wrapping the template in a function created for the frontend. is it possible that you can use the browser friendly version. Or is there something wrong with my config.

module.exports = {
    context: __dirname + '/web/src/js',
    entry: './v2/main/landing.js',
    exclude: /(node_modules|bower_components)/,
    output: {
        path: __dirname + '/web/dist/js/v2/main',
        filename: 'bundle.js',
    },
    externals: {
        // require("jquery") is external and available
        //  on the global var jQuery
        "jquery": "jQuery"
    },
    resolve: {
        root: __dirname + '/web/src/js',
        alias: {
            'handlebars': 'handlebars/dist/cjs/handlebars.js'
        }
    },
    module: {
        loaders: [
        {
            test: /\.js$/,
            exclude: /(node_modules|bower_components)/,
            loader: 'babel',
            query: {
                presets: ['es2015']
            }
        }, {
            test: /\.json$/,
            loader: 'json'
        }, {
            test: /\.html$/,
            loader: "handlebars-loader",
            query: {
                knownHelpers: ['tmplUserData']
            }
        }]
    }
}

pbrain19 avatar Jul 15 '16 20:07 pbrain19

👍

vladperelmuter avatar Jul 15 '16 21:07 vladperelmuter

👍

pbrain19 avatar Jul 15 '16 21:07 pbrain19

👍

robsicat avatar Jul 15 '16 21:07 robsicat

Feel free to submit a pull request with a fix!

pcardune avatar Jul 18 '16 20:07 pcardune