bublejs / buble

https://buble.surge.sh
MIT License
870 stars 67 forks source link

[question] How do I support `import` and `export` with buble #245

Closed fengxinming closed 4 years ago

fengxinming commented 4 years ago

Only use buble to transform import and export into require and exports.

var buble = require( 'buble' );
var result = buble.transform( source ); // { code: ..., map: ... }
huozhi commented 4 years ago

hi @fengxinming , import/export and require/exports are module standards which first one belongs to ESModule and second one belongs to CommonJS. I believe buble is more focusing on compiling syntaxes to ES2015, without transpiling your ESModule to CJS modules. check https://buble.surge.sh/guide/#using-es-modules

similar issue here https://github.com/bublejs/buble/issues/143

mourner commented 4 years ago

Yep, out of scope for this library.