You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a work around solution for this with Object.assign():
import MainHandlebars from "handlebars";
import * as RuntimeHandlebars from "handlebars/runtime";
const Handlebars = Object.assign(MainHandlebars, RuntimeHandlebars);
refers to: #1553
I need to import Handlebars differently when using custom helpers.
I'm using webpack.
The fiddle works as expected:
https://jsfiddle.net/5jpc9obu/
My handlebars 4.7.6 package.json is:
"browser": {
".": "./dist/cjs/handlebars.js",
"./runtime": "./dist/cjs/handlebars.runtime.js"
},
I import Handlebars in a class like this when I register a helper. Otherwise the helper is missing.
import * as Handlebars from "handlebars/runtime";
However, my entry point js uses Handlebar.compile and that only works when I import like this:
import Handlebars from 'handlebars';
My distributed js file, however, remains the same size even with the two different imports.
The text was updated successfully, but these errors were encountered: