Another "'import' and 'export' may appear only with 'sourceType: module'" related issue
See original GitHub issueHi,
I’m trying to transform a simple ES2015 application using babelify and I’m getting the following error:
export class RebelRouter extends HTMLElement { ^ ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’
I am using the following CLI command:
browserify -e src/app.js -o dist/bundle.js -t [ babelify --presets [ es2015 ] --plugins [ transform-class-properties ]]
I am using the latest version of babel, browserify and babelify.
Transformation with babel alone works perfectly fine.
I’ve also looked at the other similar issues for this project but none of the solutions appear to work for me.
Any help would be greatly appreciated,
Thank you.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
'import' and 'export' may appear only with 'sourceType: module ...
It seems to be a problem with using a newer version of Babel with babelify. – Mike Cluck. Oct 13, 2016 at 19:15....
Read more >Continued problems with issue #103 ('import' and 'export' may ...
But the Browserify command is back to failing with the original import/export error. --With @babel/preset-env installed, I tried three different ...
Read more >SyntaxError: 'import' and 'export' may appear only ... - YouTube
JavaScript : SyntaxError: ' import' and 'export ' may appear only with 'sourceType : module ' - Gulp [ Gift : Animated Search...
Read more >SyntaxError: 'import' and 'export' may appear only ... - YouTube
react-native: SyntaxError: ' import' and 'export ' may appear only with 'sourceType : module ' (1:0)Thanks for taking the time to learn more....
Read more >'import' and 'export' may appear only with 'sourceType: module ...
Coding example for the question SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' - Gulp-babel.js.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t see anything immediately obvious except the spacing in the brackets - unless that’s bad copy/paste, it would explain why babel isn’t getting your options, and thus not transpiling.
I’m triaging old issues on babelify. Since this has been inactive for ages, I’m going to close it. Feel free to re-open if there’s still something to discuss, but I’m assuming at this point it’s been too long to address in a useful way.