我正在尝试在ES6中导出多个变量:
exports.js
var TestObject = Parse.Object.extend('TestObject')
var Post = Parse.Object.extend('Post')
export default TestObject
export Post
main.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
也许我做错了方法?