1
ES6 /巴貝爾:我的文件夾看起來是這樣的:的javascript:的ReferenceError:出口沒有定義
A/
index.js
a.js
...other
我通過index.js
文件揭露a.js
內容如下:
export { foo, bar } from './a';
所以我可以使用它導入它:
import { foo, bar } from '../A';
但現在,我想在index.js
使用*
,這樣的情況下,我從a.js
出口的另一件事,就自動曝光:
export * from './a';
但是當我這樣做,我得到這個錯誤:
Uncaught ReferenceError: exports is not defined
我在這裏做錯了什麼?
@Andy你能否澄清一下 –
@Andy顯然OP所使用的環境確實理解了導入/導出,因爲它只有在使用'expor t * from'that that there is a error:p –
你必須使用像babel或traceur這樣的轉譯器將它轉換爲ES2015 – Niladri