question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enabling the parser plugin 'classProperties'

See original GitHub issue

Bug Report

docz dev builds and works fine but docz build throws SyntaxError: This experimental syntax requires enabling the parser plugin: 'classProperties'.

I am using babel-plugin-transform-class-properties when i bundle my libraries and my doczrc.js has added the @babel/plugins-syntax-transform-properties

SyntaxError: This experimental syntax requires enabling the parser plugin: 'classProperties' (7:12)
    at _class.raise (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:3938:15)
    at _class.expectPlugin (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:5252:18)
    at _class.parseClassProperty (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:8102:12)
    at _class.pushClassProperty (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:8066:30)
    at _class.parseClassMemberWithIsStatic (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7999:14)
    at _class.parseClassMember (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7936:10)
    at _class.parseClassBody (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7891:12)
    at _class.parseClass (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7841:10)
    at _class.parseStatementContent (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7172:21)
    at _class.parseStatement (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7144:17)
    at _class.parseBlockOrModuleBlockBody (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7695:23)
    at _class.parseBlockBody (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7682:10)
    at _class.parseBlock (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:7671:10)
    at _class.parseFunctionBody (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:6924:24)
    at _class.parseArrowExpression (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:6876:10)
    at _class.parseParenAndDistinguishExpression (/Users/jcarrick/Sites/react-common-components/packages/docs/node_modules/@babel/parser/lib/index.js:6492:12)

using docz@0.11.0

doczrc.js

const getRepoInfo = require('git-repo-info')
const tag = getRepoInfo().lastTag

export default {
  title: 'React Component Library',
  description: tag,
  dest: `public`,
  port: 9000,
  theme: 'theme/Theme',
  propsParser: false,
  modifyBabelRc: babelrc => ({
    ...babelrc,
    plugins: [
      '@babel/plugin-syntax-class-properties',
      '@babel/plugin-syntax-object-rest-spread',
      'emotion',
      ...babelrc.plugins
    ]
  })
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
trexguocommented, Dec 21, 2018

Met this issue when using arrow functions for event binding in a class as a child of Playground I am using typescript with Docz

3reactions
BigABcommented, Dec 13, 2018

This is still a valid bug, because using a class as a child of Playground is a valid option

Read more comments on GitHub >

github_iconTop Results From Across the Web

This experimental syntax requires enabling the parser plugin ...
I have this issue as well, I do have '@babel/plugin-proposal-class-properties' in my babel.config.js and works elsewhere just fine. 2
Read more >
This experimental syntax requires enabling one of the ...
If you are talking about Parcel.js, you need to install and configure some Babel plugins, to enable Class Private Properties and Methods:.
Read more >
babel/plugin-syntax-class-properties
Syntax only. It's unlikely you want to use this plugin directly as it only enables Babel to parse this syntax. Instead, use plugin-proposal-class-properties...
Read more >
this experimental syntax requires enabling the parser plugin
If you are talking about Parcel.js, you need to install and configure some Babel plugins, to enable Class Private Properties and Methods:.
Read more >
How do I enable ESLint classPrivateMethods parser plugin?
[Solved]-How do I enable ESLint classPrivateMethods parser plugin?-babel.js · Install theses packages. @babel/plugin-proposal-class-properties; @babel/plugin- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found