2017-08-10 11 views
0

のECMAScript 6 - オブジェクトエラーのないコンストラクタが

enter image description here

私は突然、このエラーを取得し始めています。私はwebpackとbabelを使用しています。私のストレージクラス内の はすべて問題ありません。

私はバベルを更新しませんでした。この

import Storage from './storage' 

let DB = new Storage(); 

ようstoregeクラスを使用しています。私はおそらくwebpackのエラーの原因を知らない?

  • "バベルコア": "^ 6.25.0"
  • "バベルローダ": "^ 7.1.1"
  • "バベル・プリセット・es2015": "^ 6.24.1"
  • "のWebPACK": "^ 3.3.0"

私storage.jsこの

import localStorage from './localStorage' 
import View from './view' 

let lStore = new localStorage(); 
let V = new View(); 

let data = (lStore.get('todo')) ? JSON.parse(lStore.get('todo')):{ 
    todo: [], 
    complated: [] 
}; 

export default class Storage { 

addItem(text, id){ 
    /* Store */ 
    this.store(text); 

    /* Add HTML Item */ 
    V.addToDOM(text, id); 
} 

store(text){ 
    data.todo.push(text); 
    data.complated.push(false); 

    //sync 
    this.objectLocalStorage(); 
} 

list() { 
    return data; 
} 

updateItem(id, complated){ 
    /* */ 
    data.complated[id] = complated; 

    //sync 
    this.objectLocalStorage(); 
} 

deleteItem(id){ 
    data.complated.splice(id, 1); 
    data.todo.splice(id, 1); 

    //sync 
    this.objectLocalStorage(); 
} 

/* Local Storage Set-Update-Sync */ 
objectLocalStorage() { 
    lStore.set('todo', JSON.stringify(data)); 
}} 
+0

「最近更新したBabel」(https://stackoverflow.com/q/33505992/1048572)でしたか? '。/ storage.js'はどのように見えるのですか? – Bergi

+0

'storage.js'も含めるか、少なくとも関連するエクスポートを含めてください。 – Scimonster

+0

./storageはどのように見えるのですか?そこにデフォルトの輸出がありますか? – euvl

答えて

1

てみてください次のようになります。

import { Storage } from './storage' 

let DB = new Storage(); 

storageはおそらくstorage.jsファイルのデフォルトエクスポートではありません。

関連する問題