Next.js Discord

Discord Forum

Handlebars-loader

Answered
D34dlyK1ss posted this in #help-forum
Open in Discord
How do I setup handlebars-loader? I already have the package installed.
Answered by D34dlyK1ss
/** @type {import('next').NextConfig} */

const nextConfig = {
    reactStrictMode: true,
    webpack: (config) => {
        config.resolve.alias = {
            ...config.resolve.alias,
            "handlebars/runtime": "handlebars/dist/cjs/handlebars.runtime",
            "handlebars": "handlebars/dist/cjs/handlebars.runtime"
        };
        return config;
    }
};

export default nextConfig;
View full answer

4 Replies

this is what I tried in next.config.mjs
but doesn't work
🆙
/** @type {import('next').NextConfig} */

const nextConfig = {
    reactStrictMode: true,
    webpack: (config) => {
        config.resolve.alias = {
            ...config.resolve.alias,
            "handlebars/runtime": "handlebars/dist/cjs/handlebars.runtime",
            "handlebars": "handlebars/dist/cjs/handlebars.runtime"
        };
        return config;
    }
};

export default nextConfig;
Answer