Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support bundling with rollup #1279

Closed
pravi opened this issue Nov 26, 2016 · 3 comments
Closed

support bundling with rollup #1279

pravi opened this issue Nov 26, 2016 · 3 comments

Comments

@pravi
Copy link

pravi commented Nov 26, 2016

I'm trying to bundle handlebars with rollup (as webpack has a long list of dependencies), I get the following error. Can you support bundling with rollup?

$ rollup ./lib/handlebars.js 
'default' is not exported by lib/handlebars/compiler/parser.js (imported by lib/handlebars/compiler/base.js). For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
Error: 'default' is not exported by lib/handlebars/compiler/parser.js (imported by lib/handlebars/compiler/base.js). For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
    at Module.trace (/usr/lib/nodejs/rollup/src/Module.js:362:30)
    at Module.traceExport (/usr/lib/nodejs/rollup/src/Module.js:388:29)
    at Module.trace (/usr/lib/nodejs/rollup/src/Module.js:360:36)
    at ModuleScope.findDeclaration (/usr/lib/nodejs/rollup/src/ast/scopes/ModuleScope.js:47:22)
    at Scope.findDeclaration (/usr/lib/nodejs/rollup/src/ast/scopes/Scope.js:92:39)
    at Identifier.bind (/usr/lib/nodejs/rollup/src/ast/nodes/Identifier.js:7:29)
    at /usr/lib/nodejs/rollup/src/ast/Node.js:6:34
    at AssignmentExpression.eachChild (/usr/lib/nodejs/rollup/src/ast/Node.js:21:5)
    at AssignmentExpression.bind (/usr/lib/nodejs/rollup/src/ast/Node.js:6:8)
    at AssignmentExpression.bind (/usr/lib/nodejs/rollup/src/ast/nodes/AssignmentExpression.js:29:13)
Type rollup --help for help, or visit https://github.com/rollup/rollup/wiki

@msroberts
Copy link

This is also an issue for me: because the compiled templates js file does not export anything, rollup does not modify the global Handlebars variable.

Related: #1254, #955

@nknapp
Copy link
Collaborator

nknapp commented Dec 17, 2016

Could you try manually changing the last lines of lib/handlebars/compiler/parser.js from

exports.__esModule = true;
exports['default'] = handlebars;

to

export default handlebars;

This change would revert part of commit efddc3 and it does reduce code-coverage in the istanbul report. But this reduction seems to be a reporting issue. Maybe this can be handed differently.

At first, it would be interesting if the change solves your problem.

@nknapp
Copy link
Collaborator

nknapp commented Feb 24, 2017

This should be resolved with #1315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants