Skip to content

Errors with usage in CRAv2 #6

@cpannwitz

Description

@cpannwitz

Bug

  • babel-plugin-console version: 0.2.1
  • node version: 9.5.0
  • npm (or yarn) version: yarn 1.7.0

Relevant code or config

import React, { Component } from "react";
import scope from "scope.macro";

function add100(a) {
  const oneHundred = 100;
  scope("Add 100 to another number");
  return add(a, oneHundred);
}

function add(a, b) {
  return a + b;
}

class App extends Component {
  componentDidMount = () => {
    add100(1);
  };

  render() {
    return (
      <div className="App">
      </div>
    );
  }
}

export default App;

What you did:

  1. npx create-react-app@next --scripts-version=2.0.0-next.66cc7a90
  2. yarn add babel-plugin-console & yarn add scope.macro
  3. Inserted above example code from this plugins pages in barebones CRAv2 App.js
  4. yarn start

What happened (please provide anything you think will help):

index.js:2214 ./src/App.js
Module build failed: Error: Unknown substitution "args" given
    at Array.forEach (<anonymous>)
    at Array.map (<anonymous>)
    =============
    at Array.map (<anonymous>)
    at Array.forEach (<anonymous>)

As far as I know, the upcoming Create-React-App version 2 comes with built-in support for babel-macros.
I also checked with another babel-macro plugin, which is working fine.

Edit: missed a line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions