Closed dmotz closed 5 years ago
What kind of error do you get with import/export
? We could probably specify a custom parser for falafel
to ignore them although it's kind of weird if it doesn't already.
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'
I think that is a babel error. I don't use babel, so you'll probably need to help me out with a stack trace or more details.
Sure, looks to be via falafel:
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (4:0) while parsing file: src/app.js
at Parser.pp.raise (node_modules/acorn/dist/acorn.js:1745:13)
at Parser.pp.parseStatement (node_modules/acorn/dist/acorn.js:2450:34)
at Parser.pp.parseTopLevel (node_modules/acorn/dist/acorn.js:2379:21)
at parse (node_modules/acorn/dist/acorn.js:101:12)
at module.exports (node_modules/falafel/index.js:22:15)
at DestroyableTransform.end [as _flush] (node_modules/yo-yoify/index.js:54:13)
at DestroyableTransform.<anonymous> (node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:115:49)
at DestroyableTransform.g (events.js:292:16)
at emitNone (events.js:86:13)
at DestroyableTransform.emit (events.js:185:7)
Did some digging and found this issue isn't babelify specific, it's just that yo-yoify's parser can't handle import
syntax. This is handled down the chain by falafel and ultimately acorn. Falafel is using a fairly old version of acorn and I think this might get fixed once it updates its dependency target.
I haven't found a way of getting yo-yoify to play nicely with babelify. Either yo-yoify chokes on
import
/export
syntax or babelify transforms first and prevents yo-yoify from making its own changes or I end up with runtime issues similar to #26.Has anyone had success with these in conjunction?