2017-02-01 6 views
1

mobx를 좋아하고 일부 태블릿에서 작은 응용 프로그램을 구현하고 Android WebView에서 이전 자바 스크립트와 관련된 문제가 발생했습니다 (나이 때문에 업그레이드 할 수 없음).).mobx @observable이 구형 Android 4.4 태블릿에서 오류를 throw합니다.

안드로이드 태블릿 : 그것은 나이가 자바 스크립트 엔진 @observables에 문제가되는 약 2740 mobx.js 파일 (아래 기능)에서에서처럼 보이지만 넥서스 4.4 (롤리팝)

오류는 다음과 같습니다.

저는 현재 jpack을 만들기 위해 webpack (아래 참조)을 사용하고 있습니다. 이것에 대한 도움은 내가 정말로 mobx를 앞으로 사용하고 싶기 때문에 크게 감사 할 것입니다. mobx.js

function isES6Map (thing) { 
    if (thing instanceof getGlobal().Map) { 
    return true; 
    } 
    return false; 
} 

콘솔 에러 감사

, 크리스

라인 2740 :

[mobx] 반응 또는 관찰자 슬로우 혔 캐치되지 않는 예외 구성 요소 : 'Reaction [CustomerFeedback # 0.render()] TypeError message : "instanceof 검사에서 기능을 기대하지만 위치 페이지가 있습니다" stack : (...) 스택을 얻으십시오 : function() {[native code]} 스택을 설정하십시오 : function() {[native code]} proto : 오류 mobx.js : 1284 Reaction.reportExceptionInDerivation

웹팩 :

'use strict'; 

const autoprefixer = require('autoprefixer'); 
const copyWebpackPlugin = require('copy-webpack-plugin'); 
const extractTextPlugin = require('extract-text-webpack-plugin'); 
const path = require('path'); 

const scssLoaders = [ 
    'css-loader', 
    'postcss-loader', 
    'sass-loader?indentedSyntax=false&includePaths[]=' + path.resolve(__dirname, './application') 
]; 

const config = { 
    debug: true, 
    devtool: 'source-map', 
    entry: ['babel-polyfill', './index.js'], 
    module: { 
    loaders: [ 
     { 
     test: /.(js|jsx)$/, 
     exclude: /node_modules/, 
     loader: ['babel-loader'], 
     query: { 
      cacheDirectory: true, 
      plugins: [ 
      'transform-decorators-legacy', 
      'transform-class-properties', 
      'mobx-deep-action' 
      ], 
      presets: ['es2015', 'stage-0', 'react'], 
      babelrc: false 
     } 
     }, 
     { 
     test: /.scss$/, 
     loader: extractTextPlugin.extract('style-loader', scssLoaders.join('!')) 
     }, 
     { 
     test: /.(svg|jpg|png)$/, 
     loader: 'file-loader?name=/media/[name].[ext]' 
     } 
    ] 
    }, 

    output: { 
    path: path.join(__dirname, './build'), 
    publicPath: '/build', 
    filename: '[name].js' 
    }, 

    plugins: [ 
    new extractTextPlugin('[name].css') 

    ], 

    postcss: [ 
    autoprefixer({ 
     browsers: ['last 2 versions'] 
    }) 
    ], 

    resolve: { 
    extensions: ['', '.js', '.jsx', '.scss'], 
    modulesDirectories: ['./node_modules/'], 
    root: [path.join(__dirname, './application')] 
    } 
}; 

module.exports = config; 

의 AppState 파일 :

import { action, computed, extendObservable, toJS } from 'mobx'; 

class CustomerFeedbackState { 
    constructor() { 
    // Initializes all observables 
    this.initializeStoreData(); 
    } 

    /* ACTIONS */ 
    // Initialize the store's state, allowing a reinitialization of the app as needed (reset to default state) 
    @action initializeStoreData() { 
    extendObservable(this, { 
     // Keeps track of what page the user is on - 'locations-page' is the start page 
     currentPageName: 'locations-page', 

     // Keeps track of what question is being asked 
     currentQuestionNumber: 0, 

     // Set to true when the JSON data comes back successful 
     dataFetched: false, 

     // sets the active state for the next button 
     disableNextPage: true, 

     // Keeps track of page history 
     lastPageVisitedArray: [], 

     // Current Location Id 
     locationId: 0, 

     // Mood link active states 
     moodLinkHappyIsActive: false, 
     moodLinkNeutralIsActive: false, 
     moodLinkSadIsActive: false, 

     // Next page available 
     nextPage: '', 

     // User mood 
     userMood: '' 
    }); 
    }, 
    // ... 
} 
+0

실제로 코드에'babel-polyfill'을 사용하고 있습니까? 'import babel-polyfill'; ' – Tholle

+1

예 @Tholle, webpack.config에 있습니다 : ['babel-polyfill ','./index.js '], – Centinel3

+0

아, 그걸 놓쳤습니다. 매우 흥미로운. [** 문제 제기 **] (https://github.com/mobxjs/mobx/issues/new) 가치가 있을까요? – Tholle

답변

2

이 문제는 지난 주 3.0.2 릴리스에서 해결되었습니다 (mobx 개발자의 피드백에 따라).