I'm learning ES6, I wrote the test code like below:
// export.js:
class Test {
constructor() {
console.log('teste5ty')
}
}
class Test2 {
constructor() {
console.log('test2')
}
}
export {Test, Test2}
export default Test
another export file code is below:
// test2.js
class Teste3 {
construct() {
console.log('heheheheh')
}
}
export default Teste3
finally, test code as below:
import Test from './export'
import {Test2} from './export'
import Teste3 from './test2'
new Test()
new Test2()
new Teste3()
after transforming to es5 by Babel, I got the output like below:
teste5ty
test2
Apparently, Test3 is not instantiated, why this happens??
via TreeCatCat
No comments:
Post a Comment