我正在尝试在ES6中导出多个变量:
exports.js
var TestObject = Parse.Object.extend('TestObject')
var Post = Parse.Object.extend('Post')
export default TestObject
export Post
主文件.js:
import TestObject from '../store'
import Post from '../store'
var testObject = new TestObject() // use Post in the same way
testObject.save(json).then(object => {
console.log('yay! it worked', object)
})
我知道只有一个默认值,所以我只在第一项中使用了default
。但是,我收到了这个错误信息:Module build failed: SyntaxError: /home/alex/node/my-project/src/store/index.js: Unexpected token (9:7)
7 |
8 | export default TestObject
> 9 | export Post
也许我做错了?