ember-cli-babel icon indicating copy to clipboard operation
ember-cli-babel copied to clipboard

Upgrade to ember 2.15 triggers this message

Open nizarayari opened this issue 8 years ago • 2 comments

Hi there,

I got this message coming from broccoli-babel-transpiler when I upgraded my ember app to ember 2.15.0

broccoli-babel-transpiler is opting out of caching due to a plugin that does not provide a caching strategy: `function () {
  return {
    visitor: {
      VariableDeclaration: function VariableDeclaration(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        if (!isBlockScoped(node)) return;
        convertBlockScopedToVar(path, null, parent, scope, true);

        if (node._tdzThis) {
          var nodes = [node];

          for (var i = 0; i < node.declarations.length; i++) {
            var decl = node.declarations[i];
            if (decl.init) {
              var assign = t.assignmentExpression("=", decl.id, decl.init);
              assign._ignoreBlockScopingTDZ = true;
              nodes.push(t.expressionStatement(assign));
            }
            decl.init = file.addHelper("temporalUndefined");
          }

          node._blockHoist = 2;

          if (path.isCompletionRecord()) {
            nodes.push(t.expressionStatement(scope.buildUndefinedNode()));
          }

          path.replaceWithMultiple(nodes);
        }
      },
      Loop: function Loop(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        t.ensureBlock(node);
        var blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file);
        var replace = blockScoping.run();
        if (replace) path.replaceWith(replace);
      },
      CatchClause: function CatchClause(path, file) {
        var parent = path.parent,
            scope = path.scope;

        var blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file);
        blockScoping.run();
      },
      "BlockStatement|SwitchStatement|Program": function BlockStatementSwitchStatementProgram(path, file) {
        if (!ignoreBlock(path)) {
          var blockScoping = new BlockScoping(null, path, path.parent, path.scope, file);
          blockScoping.run();
        }
      }
    }
  };
}`.

nizarayari avatar Sep 12 '17 10:09 nizarayari

Getting the same issue on ember 2.15.1
Then subsequent builds fail on some "Cannot read property 'visitors' of undefined" I do not use the word visitors within my app, so it is somewhere in the ember-stack.

Seems like this is related to: https://github.com/ember-cli/babel-plugin-feature-flags/issues/13 And this: https://github.com/emberjs/data/issues/5164

Full console output from ember serve:
DEPRECATION: ember-cli-htmlbars-inline-precompile is opting out of caching due to an AST plugin that does not provide a caching strategy: `conditional-compile-template`.
DEPRECATION: ember-cli-htmlbars is opting out of caching due to an AST plugin that does not provide a caching strategy: `conditional-compile-template`.
DEPRECATION: Addon files were detected in `ember-app/node_modules/ember-delay/addon`, but no JavaScript preprocessors were found for `ember-delay`. Please make sure to add a preprocessor (most likely `ember-cli-babel`) to in `dependencies` (NOT `devDependencies`) in `ember-delay`'s `package.json`.
DEPRECATION: Addon files were detected in `ember-app/node_modules/ember-backoff/addon`, but no JavaScript preprocessors were found for `ember-backoff`. Please make sure to add a preprocessor (most likely `ember-cli-babel`) to in `dependencies` (NOT `devDependencies`) in `ember-backoff`'s `package.json`.
Livereload server on https://localhost:49153
broccoli-babel-transpiler is opting out of caching due to a plugin that does not provide a caching strategy: `function () {
  return {
    visitor: {
      VariableDeclaration: function VariableDeclaration(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        if (!isBlockScoped(node)) return;
        convertBlockScopedToVar(path, null, parent, scope, true);

        if (node._tdzThis) {
          var nodes = [node];

          for (var i = 0; i < node.declarations.length; i++) {
            var decl = node.declarations[i];
            if (decl.init) {
              var assign = t.assignmentExpression("=", decl.id, decl.init);
              assign._ignoreBlockScopingTDZ = true;
              nodes.push(t.expressionStatement(assign));
            }
            decl.init = file.addHelper("temporalUndefined");
          }

          node._blockHoist = 2;

          if (path.isCompletionRecord()) {
            nodes.push(t.expressionStatement(scope.buildUndefinedNode()));
          }

          path.replaceWithMultiple(nodes);
        }
      },
      Loop: function Loop(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        t.ensureBlock(node);
        var blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file);
        var replace = blockScoping.run();
        if (replace) path.replaceWith(replace);
      },
      CatchClause: function CatchClause(path, file) {
        var parent = path.parent,
            scope = path.scope;

        var blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file);
        blockScoping.run();
      },
      "BlockStatement|SwitchStatement|Program": function BlockStatementSwitchStatementProgram(path, file) {
        if (!ignoreBlock(path)) {
          var blockScoping = new BlockScoping(null, path, path.parent, path.scope, file);
          blockScoping.run();
        }
      }
    }
  };
}`.
broccoli-babel-transpiler is opting out of caching due to a plugin that does not provide a caching strategy: `function () {
  return {
    visitor: {
      VariableDeclaration: function VariableDeclaration(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        if (!isBlockScoped(node)) return;
        convertBlockScopedToVar(path, null, parent, scope, true);

        if (node._tdzThis) {
          var nodes = [node];

          for (var i = 0; i < node.declarations.length; i++) {
            var decl = node.declarations[i];
            if (decl.init) {
              var assign = t.assignmentExpression("=", decl.id, decl.init);
              assign._ignoreBlockScopingTDZ = true;
              nodes.push(t.expressionStatement(assign));
            }
            decl.init = file.addHelper("temporalUndefined");
          }

          node._blockHoist = 2;

          if (path.isCompletionRecord()) {
            nodes.push(t.expressionStatement(scope.buildUndefinedNode()));
          }

          path.replaceWithMultiple(nodes);
        }
      },
      Loop: function Loop(path, file) {
        var node = path.node,
            parent = path.parent,
            scope = path.scope;

        t.ensureBlock(node);
        var blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file);
        var replace = blockScoping.run();
        if (replace) path.replaceWith(replace);
      },
      CatchClause: function CatchClause(path, file) {
        var parent = path.parent,
            scope = path.scope;

        var blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file);
        blockScoping.run();
      },
      "BlockStatement|SwitchStatement|Program": function BlockStatementSwitchStatementProgram(path, file) {
        if (!ignoreBlock(path)) {
          var blockScoping = new BlockScoping(null, path, path.parent, path.scope, file);
          blockScoping.run();
        }
      }
    }
  };
}`.
'instrument' is imported from external module 'ember-data/-debug' but never used
The Broccoli Plugin: [BroccoliMergeTrees: TreeMerger (preprocessedApp & templates)] failed with:
TypeError: Cannot read property 'visitors' of undefined
    at preprocess (ember-app/node_modules/ember-source/dist/ember-template-compiler.js:3921:47)
    at exports.precompile (ember-app/node_modules/ember-source/dist/ember-template-compiler.js:1551:42)
    at Object.exports.default (ember-app/node_modules/ember-source/dist/ember-template-compiler.js:16398:12)
    at Object.template (ember-app/node_modules/ember-cli-htmlbars/utils.js:29:40)
    at TemplateCompiler.processString (ember-app/node_modules/ember-cli-htmlbars/index.js:76:40)
    at Promise.then.result.output (ember-app/node_modules/broccoli-persistent-filter/lib/strategies/persistent.js:41:23)
    at initializePromise (ember-app/node_modules/rsvp/dist/rsvp.js:589:5)
    at new Promise$1 (ember-app/node_modules/rsvp/dist/rsvp.js:1077:33)
    at ember-app/node_modules/broccoli-persistent-filter/lib/strategies/persistent.js:40:18
    at tryCatch (ember-app/node_modules/rsvp/dist/rsvp.js:539:12)
    at invokeCallback (ember-app/node_modules/rsvp/dist/rsvp.js:554:13)
    at publish (ember-app/node_modules/rsvp/dist/rsvp.js:522:7)
    at flush (ember-app/node_modules/rsvp/dist/rsvp.js:2414:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)


The broccoli plugin was instantiated at:
    at BroccoliMergeTrees.Plugin (ember-app/node_modules/broccoli-plugin/index.js:7:31)
    at new BroccoliMergeTrees (ember-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:16:10)
    at Function.BroccoliMergeTrees [as _upstreamMergeTrees] (ember-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:10:53)
    at mergeTrees (ember-app/node_modules/ember-cli/lib/broccoli/merge-trees.js:85:33)
    at EmberApp._mergeTrees (ember-app/node_modules/ember-cli/lib/broccoli/ember-app.js:1832:12)
    at EmberApp.appAndDependencies (ember-app/node_modules/ember-cli/lib/broccoli/ember-app.js:1130:51)
    at EmberApp.javascript (ember-app/node_modules/ember-cli/lib/broccoli/ember-app.js:1253:30)
    at EmberApp.toArray (ember-app/node_modules/ember-cli/lib/broccoli/ember-app.js:1689:12)
    at EmberApp.toTree (ember-app/node_modules/ember-cli/lib/broccoli/ember-app.js:1711:38)
    at module.exports (ember-app/ember-cli-build.js:129:14)
    at Builder.setupBroccoliBuilder (ember-app/node_modules/ember-cli/lib/models/builder.js:56:19)
    at new Builder (ember-app/node_modules/ember-cli/lib/models/builder.js:30:10)
    at ServeTask.run (ember-app/node_modules/ember-cli/lib/tasks/serve.js:24:55)
    at Promise.resolve.then (ember-app/node_modules/ember-cli/lib/models/command.js:243:46)
    at tryCatch (ember-app/node_modules/rsvp/dist/rsvp.js:539:12)
    at invokeCallback (ember-app/node_modules/rsvp/dist/rsvp.js:554:13)
    at ember-app/node_modules/rsvp/dist/rsvp.js:629:16
    at flush (ember-app/node_modules/rsvp/dist/rsvp.js:2414:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Duder-onomy avatar Sep 20 '17 00:09 Duder-onomy

@nizarayari I figured out that, at least in the app I am working on, I needed to upgrade ember-hammertime.

If you look at the offending line's source code:

pluginResult = transform(env);
traverse(program, pluginResult.visitors);

and log the transform you will see a ton of [Function] but! eventually, you will see [Function: bound TouchActionSupport] right before the exception occurs. TouchActionSupport comes from ember-hammertime.

The latest version of ember-hammertime has some fix for AST Parsing: image

So, maybe upgrade to the latest ember-hammertime and see what happens? Hope this fixes things for you!

Duder-onomy avatar Oct 28 '17 00:10 Duder-onomy