Wednesday, 17 May 2017

observable is not defined error on page load

I am trying to get mobx/reactjs to work but I keep running into

"observable is not defined"

import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import {observer} from 'mobx-react';
import {observable} from 'mobx';

  class Test{
       @observable year
  }

.babelrc

{
    "presets": ["stage-1", "es2015", "react"],
    "plugins": ["transform-decorators-legacy", "transform-class-properties"]
}

webpack

module.exports = {
    entry: './src/app.js',
    output: {
        filename: './dist/app.bundle.js'
    },
   module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "babel-loader"
            }
        ]
    }

}

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "webpack -d --watch",
    "prod": "webpack -p "
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.24.1",
    "babel-loader": "^7.0.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "mobx": "^3.1.9",
    "mobx-react": "^4.1.8",
    "react": "^15.5.4",
    "react-dom": "^15.5.4",
    "webpack": "^2.5.1"
  },
  "dependencies": {
    "mobx-react": "^4.1.8"
  }
}



via chobo2

No comments:

Post a Comment