-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Errors with usage in CRAv2 #6
Comments
I have experienced the exact same problem with |
Get the same error message 😣 |
Found the problem. const buildLog = template => (...args) => level => {
if (level == 0) {
return template('console.log(args);')({ args });
}
const indentation = indentWith(level, '| ', '| ');
return template(`
if (typeof window !== 'undefined') {
console.log(args);
} else {
console.log('${indentation}', args);
}
`)({ args });
}; Should be: const buildLog = template => (...args) => level => {
if (level == 0) {
return template('console.log(ARGS);')({ ARGS });
}
const indentation = indentWith(level, '| ', '| ');
return template(`
if (typeof window !== 'undefined') {
console.log(ARGS);
} else {
console.log('${indentation}', ARGS);
}
`)({ ARGS });
}; There are also other usages that need changing. Placeholders must be capitalized. Note the lowercase placeholder in the babel template. https://babeljs.io/docs/en/next/babel-template.html#placeholderpattern:
|
PR: #8 |
Experiencing this issue with CRAv3 Using Typescript with CRA on MacOS. |
Bug
babel-plugin-console
version: 0.2.1node
version: 9.5.0npm
(oryarn
) version: yarn 1.7.0Relevant code or config
What you did:
npx create-react-app@next --scripts-version=2.0.0-next.66cc7a90
yarn add babel-plugin-console
&yarn add scope.macro
App.js
yarn start
What happened (please provide anything you think will help):
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.
The text was updated successfully, but these errors were encountered: