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.

static propTypes Unexpected token

See original GitHub issue

Hi,

I am getting this error

Module parse failed: /Users/aris/project/front/views/components/.....jsx Unexpected token (19:21)
You may need an appropriate loader to handle this file type.
| class xxx extends React.Component {
|
|     static propTypes = {
|         propOne: React.PropTypes.func,
|         propTwo: React.PropTypes.bool,
 @ ./~/react-styleguidist/loaders/styleguide.loader.js!./~/react-styleguidist/src/index.js 77:10-76
 @ ./~/react-styleguidist/src/index.js
 @ multi main

I have a working-in-production react-webpack stack and i am loading all my loaders from my webpack configuration:

styleguide.config.js

    title: 'Styleguide',
    components: './views/components/**/*.jsx',
    serverPort: 3005,
    updateWebpackConfig(webpackConfig) {
        webpackConfig.module.loaders.concat(configuration.module.loaders);
        return webpackConfig;
    }

I have a .babelrc file which includes stage-0 of ES7 and also I have a separate config file for babel loader in my webpack config.

PS: I am using Webpack 2.1.0-beta.25

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
n1313commented, Dec 6, 2016

I had this issue when I misconfigured my include/exclude paths and the imported file with spread operator was not “covered” by my loaders.

1reaction
sapegincommented, Nov 9, 2016

@stinoga Please, don’t include any Styleguidist pathes into your own loaders.

And I can’t reproduce it. Please make an example project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactJS: Unexpected token error from static proptypes
Step : 1 - I am assuming you are installing prop-types npm install --save prop-types as a seperate library and then importing it...
Read more >
static propTypes. Module parse failed: Unexpected token #1055
Hello I've been trying to setup react-styleguidist for my react-native project for several hours now and I'm stuck.
Read more >
Unexpected token error from static proptypes-Reactjs
Coding example for the question ReactJS: Unexpected token error from static proptypes-Reactjs.
Read more >
eslint static proptypes unexpected token
eslint static proptypes unexpected token = · proptypes react not working · parsing error identifier proptypes has already been declared · module parse...
Read more >
expo you may need an appropriate loader to handle this file ...
App.js 8:4 Module parse failed: Unexpected token (8:4) You may need an appropriate loader to ... Component { > static propTypes = {...
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