davis / plugin-hbs

Handlebars template loader plugin for SystemJS
MIT License
21 stars 9 forks source link

Imports Handlebars as a non-named module #16

Closed ffflabs closed 6 years ago

ffflabs commented 6 years ago

In PR #13 the meta format when set to esm would perform

import {Handlebars} from 'handlebars/handlebars.runtime.js'; \n export default Handlebars.template(${precompiled});

But, since SystemJS release v0.20.0, I quote:

Breaking Changes: Removes the ability to use named imports from non-ES modules (eg import {readFile} from 'fs' should be import fs from 'fs'; fs.readFile).

So import {Handlebars} now returns undefined. I guess nobody was using this meta, but anyway, with this PR I fixed that issue to import as the default export.

import Handlebars from '${handlebarsRuntimePath}'; \n export default Handlebars.template(${precompiled});

Which returns the proper object.