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

Upgrade to ember 2.15 triggers this message #181

Open
nizarayari opened this issue Sep 12, 2017 · 2 comments
Open

Upgrade to ember 2.15 triggers this message #181

nizarayari opened this issue Sep 12, 2017 · 2 comments

Comments

@nizarayari
Copy link

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();
        }
      }
    }
  };
}`.
@Duder-onomy
Copy link

Duder-onomy commented Sep 20, 2017

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: ember-cli/babel-plugin-feature-flags#13
And this: emberjs/data#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
Copy link

@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!

siva-sundar pushed a commit to siva-sundar/ember-cli-babel that referenced this issue Feb 11, 2021
[feature] adds heimdall monitor for logging information helpful for debugging babel process
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

2 participants