ember-cli-conditional-compile icon indicating copy to clipboard operation
ember-cli-conditional-compile copied to clipboard

Transpiler error

Open tehmaestro opened this issue 7 years ago • 0 comments

Hi, I just upgraded to Ember 2.13 from 2.8, updated a bunch of dependencies together with this plugin. When I try to build for production, I get a very long error which starts with:

broccoli-babel-transpiler is opting out of caching due to a plugin that does not provide a caching strategy: (babel) => {
 const t = babel.types
 // cache for performance
 const parseMap = {}
 return {
   visitor: {
     Identifier(path, state) {
       if (path.parent.type === 'MemberExpression') {
         return;
       }
       if (path.parent.type === 'ClassMethod') {
         return;
       }
       if (path.isPure()) {
         return;
       }
       if (!state.opts.hasOwnProperty(path.node.name)) {
         return;
       }
       let replacementDescriptor = state.opts[path.node.name]
       if (replacementDescriptor === undefined || replacementDescriptor === null) {
         replacementDescriptor = t.identifier(String(replacementDescriptor))
       }
//.....

 Property key of ObjectProperty expected node to be of a type ["Identifier","StringLiteral","NumericLiteral"] but instead got "BooleanLiteral"

    at File.transform (node_modules\ember-cli-conditional-compile\node_modules\babel-core\lib
\transformation\file\index.js:548:35)
    at node_modules\ember-cli-conditional-compile\node_modules\babel-core\lib\transformation\
pipeline.js:50:19
    at File.wrap (node_modules\ember-cli-conditional-compile\node_modules\babel-core\lib\tran
sformation\file\index.js:564:16)
    at Pipeline.transform (node_modules\ember-cli-conditional-compile\node_modules\babel-core
\lib\transformation\pipeline.js:47:17)
    at Promise node_modules\ember-cli-conditional-compile\node_modules\broccoli-babel-transp
iler\lib\parallel-api.js:102:26)
    at initializePromise (node_modules\rsvp\dist\rsvp.js:567:5)
    at new Promise (node_modules\rsvp\dist\rsvp.js:1033:31)
    at Object.transformString (node_modules\ember-cli-conditional-compile\node_modules\brocco
li-babel-transpiler\lib\parallel-api.js:101:12)
    at Babel.transform (node_modules\ember-cli-conditional-compile\node_modules\broccoli-babe
l-transpiler\index.js:80:22)
    at Babel.processString (node_modules\ember-cli-conditional-compile\node_modules\broccoli-
babel-transpiler\index.js:180:15)
    at Promise.then.result.output (node_modules\broccoli-persistent-filter\lib\strategies\per
sistent.js:41:23)

I don't really know what do to. I tried uninstalling this addon, and the build was successful.

UPDATE

I have a property in one of my services, named exactly the same as the feature flag.

  export default Ember.Service.extend({
    myFeatureFlag: function() {
       return config.featureFlags && config.featureFlags.myFeatureFlag
   }.property()
})

If I remove it, or rename the property, it builds (except for the opting out of cache part). Even if I make it myFeatureFlag: true, it still doesn't work. Is this something expected?

NEW UPDATE:

I installed version 1.0.2 of this addon, and it works. 1.0.3 fails. So there seems to be an issue with this pull request: https://github.com/minichate/ember-cli-conditional-compile/pull/41

tehmaestro avatar Jul 05 '17 10:07 tehmaestro