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

Implement hbs for ember-twiddle #326

Closed
Gaurav0 opened this issue Feb 17, 2016 · 10 comments
Closed

Implement hbs for ember-twiddle #326

Gaurav0 opened this issue Feb 17, 2016 · 10 comments

Comments

@Gaurav0
Copy link
Contributor

Gaurav0 commented Feb 17, 2016

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 24, 2016

Fixed by #337

@Gaurav0 Gaurav0 closed this as completed Feb 24, 2016
@Gaurav0 Gaurav0 reopened this Feb 25, 2016
@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 25, 2016

So this didn't work in canary. I tracked down the issue and there is a bug in minification. Disabled the minification of assets/vendor.js in canary for now. Help wanted.

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 25, 2016

To reproduce:

  1. git pull/clone master branch
  2. Edit ember-cli-build not to exclude assets/vendor.js from minification
  3. Disable fingerprinting in production (or prepending of domain) so production env works locally
  4. ember server --environment=production
  5. Go to localhost:4200 in browser

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 25, 2016

This is the error:

TypeError: application/template.hbs: The plugin function (t){var r=t.types,n=function(t,r){var n="Ember.HTMLBars.template("+e(r)+")";return t.replaceWithSourceString?void t.replaceWithSourceString(n):n};return new t.Transformer("htmlbars-inline-precompile",{ImportDeclaration:function(e,t,n,i){if(r.isLiteral(e.source,{value:"htmlbars-inline-precompile"})){var a=e.specifiers&&e.specifiers[0];if(!r.isImportDefaultSpecifier(a)){var o=i.code,s=o.slice(e.start,e.end),l="Only import hbs from 'htmlbars-inline-precompile' is supported. You used: "+s+"";throw i.errorWithNode(e,l)}i.importSpecifier=a.local.name,"function"==typeof this.dangerouslyRemove?this.dangerouslyRemove():this.remove()}},CallExpression:function(e,t,i,a){if(r.isIdentifier(e.callee,{name:a.importSpecifier})){var o="hbs should be invoked with a single argument: the template string";if(1!==e.arguments.length)throw a.errorWithNode(e,o);var s=e.arguments[0].value;if("string"!=typeof s)throw a.errorWithNode(e,o);return n(this,s)}},TaggedTemplateExpression:function(e,t,i,a){if(r.isIdentifier(e.tag,{name:a.importSpecifier})){if(e.quasi.expressions.length)throw a.errorWithNode(e,"placeholders inside a tagged template string are not supported");var o=e.quasi.quasis.map(function(e){return e.value.cooked}).join("");return n(this,o)}}})} didn't export a Plugin instance

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 25, 2016

Turning off name mangling in uglify also fixes the issue. To do so, use

minifyJS: {
      enabled: isProductionLikeBuild,
      options: {
        mangle: false
      }
    },

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 25, 2016

Issue was with Babel requiring constructor.name === "Plugin" but the Plugin class constructor function's name was mangled by Uglify. Fixed by treating 'Plugin' as reserved word during minification.

@Gaurav0 Gaurav0 closed this as completed Feb 25, 2016
@pangratz
Copy link
Contributor

Issue was with Babel requiring constructor.name === "Plugin" but the Plugin class constructor function's name was mangled by Uglify. Fixed by treating 'Plugin' as reserved word during minification.

wow, awesome detective work @Gaurav0 🔍

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 25, 2016

@pangratz Now should I report it as a bug to Babel or Uglify or both?

@pangratz
Copy link
Contributor

I would say this is an uglify issue

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Feb 25, 2016

@pangratz Reported

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

No branches or pull requests

2 participants