# Strange Webpack Build Error

**URL:** <https://forum.freecodecamp.org/t/strange-webpack-build-error/82208>\
**Category:** General\
**Created:** [January 31, 2017, 1:38am UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208 "2017-01-31T01:38:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![codefu-chivy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codefu-chivy/32/67050_2.png) [@codefu-chivy](https://forum.freecodecamp.org/u/codefu-chivy)\
**Post date:** [January 31, 2017, 1:38am UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208/1 "2017-01-31T01:38:40Z")

</div>

I’m currently working on the voting app and I’m just starting to test all of my modules to see if they work, by running the server. However, when I do so, I’m presented with a Webpack build error stating “Unexpected token” errors for these types of functions and objects:

```auto
static contextTypes = {
     | ^
  15 | authenticated: React.PropTypes.bool,
  16 | user: React.PropTypes.object
  17 | };

```

and

```auto
componentDidMount = () => {
     | ^

```

It’s only showing problems with modules with this kind of syntax. I figured it wasn’t recognizing the es6, but all of my other modules are running fine. I have no idea why it’s giving this error.

---

<div class="post-metadata">

**Author:** ![codefu-chivy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codefu-chivy/32/67050_2.png) [@codefu-chivy](https://forum.freecodecamp.org/u/codefu-chivy)\
**Post date:** [January 31, 2017, 1:39am UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208/2 "2017-01-31T01:39:23Z")

</div>

The error arrows are supposed to be pointing at the assignment operator.

---

<div class="post-metadata">

**Author:** ![PortableStick](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/portablestick/32/65591_2.png) [@PortableStick](https://forum.freecodecamp.org/u/PortableStick)\
**Post date:** [January 31, 2017, 2:15am UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208/3 "2017-01-31T02:15:04Z")

</div>

I cleaned up your code (but it didn’t help much).  
You need to use triple backticks to post code to the forum.  
See [this post for details](http://forum.freecodecamp.com/t/forum-code-formatting/25574).

Could you post a link to your repo? I’d be interested in seeing your code.

---

<div class="post-metadata">

**Author:** ![codefu-chivy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codefu-chivy/32/67050_2.png) [@codefu-chivy](https://forum.freecodecamp.org/u/codefu-chivy)\
**Post date:** [January 31, 2017, 2:30am UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208/4 "2017-01-31T02:30:45Z")

</div>

Thanks! I’ll remember to do this in the future. This is my repo: [https://github.com/codefu-chivy/pollers-app](https://github.com/codefu-chivy/pollers-app)

---

<div class="post-metadata">

**Author:** ![joesmith100](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/joesmith100/32/34933_2.png) [@joesmith100](https://forum.freecodecamp.org/u/joesmith100)\
**Post date:** [January 31, 2017, 11:38am UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208/5 "2017-01-31T11:38:56Z")

</div>

Hi @codefu-chivy

The problem is you’re using the `static` class property, which is in the es7 draft, without an appropriate babel transform.

The easiest way to get babel to transpile those properties is to use a stage-x preset: [https://babeljs.io/docs/plugins/](https://babeljs.io/docs/plugins/).

stage-2 has the transform-class-properties plugin in it, although, I tend to use stage-0 as it encompasses all 3 stages and includes things like object spread.

```auto
npm install --save-dev babel-preset-stage-0

```

```auto
// babelrc
presets: ['es2015', 'react', 'stage-0']

```

That should fix the issue.

FYI, you don’t need the presets inside the webpack config as well, just having the babelrc is fine.

---

<div class="post-metadata">

**Author:** ![codefu-chivy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codefu-chivy/32/67050_2.png) [@codefu-chivy](https://forum.freecodecamp.org/u/codefu-chivy)\
**Post date:** [January 31, 2017, 3:59pm UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208/6 "2017-01-31T15:59:55Z")

</div>

Thanks a lot! I had actually installed and saved stage-0 to my package.json but I didn’t include it in my .babelrc. I honestly didn’t know what it was for. Thanks for the advice!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 5:12pm UTC](https://forum.freecodecamp.org/t/strange-webpack-build-error/82208/7 "2021-01-16T17:12:09Z")

</div>

Closed on January 16, 2021, 5:12pm UTC


