Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method does not exist: math #9

Open
muuvmuuv opened this issue Mar 9, 2019 · 3 comments
Open

Method does not exist: math #9

muuvmuuv opened this issue Mar 9, 2019 · 3 comments

Comments

@muuvmuuv
Copy link

muuvmuuv commented Mar 9, 2019

Tried some new functions from polish today with some errors... Here I downloaded and added a test to your plugin (btw, please add jest as dev dep.)

   polished  2. math

    SyntaxError: unknown: Method does not exist: math
    > 1 | import { math } from 'polished';
        |         ^
      2 |
      3 | let a = math('12px + 12px')

      44 |
      45 |             if (!value) {
    > 46 |               throw imported.buildCodeFrameError('Method does not exist: ' + importedName);
         |                              ^
      47 |             }
{
      title: "math",
      code: `
        import { math } from 'polished';

        let a = math('12px + 12px')
      `,
      output: `
        let a = '14px';
      `
    }

Related to: Corjen/gatsby-plugin-polished#1

@andrejpavlovic
Copy link

The issue seems to be that babel-plugin-polished is pegged to v1 of polished:

"dependencies": {
"polished": "^1.0.0"
},

That should be updated to v3 or maybe better set in peerDependencies

@andrejpavlovic
Copy link

Look like someone already submitted a pr...
#8

@asherccohen
Copy link

asherccohen commented Mar 13, 2020

Hi, I'm having the same problem with fluidRange.

"babel-plugin-polished": "^1.1.0",
"polished": "^3.4.4",

Weird though because some methods can be used and others break.

transparentize, opacify, darken for example are ok to import like:
import { transparentize, opacify, darken } from 'polished';

But when I try with fluidRange i get:
SyntaxError Method does not exist: fluidRange

FYI I also tried importing default like this:
import * as polished from 'polished';

and if I log polished it actually shows me all the methods including fluidRange, but then breaks.

[EDIT]

I guess @andrejpavlovic is right, any chance we can get this PR merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants