Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Strange error #155

Closed
Riim opened this issue Aug 9, 2017 · 3 comments · Fixed by #158
Closed

Strange error #155

Riim opened this issue Aug 9, 2017 · 3 comments · Fixed by #158

Comments

@Riim
Copy link

Riim commented Aug 9, 2017

Sorry for my English.

When upgrading from version 3.0.0 to version 3.0.1 the error occurs:

(babel plugin) TypeError: /Users/Riim/dev/cellx/src/x.js: Property declaration of ExportDefaultDeclaration expected node to be of a type ["FunctionDeclaration","ClassDeclaration","Expression"] but instead got "ExpressionStatement"
src/cellx.js

File /Users/Riim/dev/cellx/src/x.js in system not exist.
If I comment all content of the input file (https://github.com/Riim/cellx/blob/master/src/cellx.js), an error is still present.

Thanks!

@petamoriken
Copy link

@hzoo I got the same error in v3.0.1 (maybe this occurred by #154):

Error: (babel plugin) TypeError: /home/travis/build/petamoriken/float16/src/x.js: Property declaration of ExportDefaultDeclaration expected node to be of a type ["FunctionDeclaration","ClassDeclaration","Expression"] but instead got "ExpressionStatement"
src/index.js

https://travis-ci.org/petamoriken/float16/builds/262640105

related: #156

targos added a commit to image-js/image-js that referenced this issue Aug 10, 2017
@diervo
Copy link

diervo commented Aug 13, 2017

@hzoo after a painful debugging a found the problem: #154 Doesn't really address the issue.
The precheckingFlight() function with the peer version of babel-core (6.x) for this package is missing an extra check on the replacePath method:
https://github.com/babel/babel/blob/7.0/packages/babel-traverse/src/path/replacement.js#L143

It shouldn't be entering that branch that will create a expressionStatement.

Right now babily master is broken (it does not build) because of this, so we should fix it asap.

The fix is to add that check to babel branch 6.x.

diervo added a commit to diervo/babel that referenced this issue Aug 13, 2017
Fixes: rollup/rollup-plugin-babel#155 which in turn fixes the ability to build babily(master)
@michalbe
Copy link

Downgrading to "rollup-plugin-babel": "^2.7.1" seems to solve this issue.

nicolo-ribaudo added a commit to nicolo-ribaudo/rollup-plugin-babel that referenced this issue Aug 14, 2017
Since in Babel 6 it is not supported to replace the argument
of a default export declaration with an expression, use a
custom "replaceWith" function which handles also that case.

Fixes rollup#155, fixes rollup#156.
@hzoo hzoo closed this as completed in #158 Aug 15, 2017
hzoo pushed a commit that referenced this issue Aug 15, 2017
* Fix regression with Babel 6

Since in Babel 6 it is not supported to replace the argument
of a default export declaration with an expression, use a
custom "replaceWith" function which handles also that case.

Fixes #155, fixes #156.

* Run tests using both Babel 7 and Babel 6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants