Method does not exist: math
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: https://github.com/Corjen/gatsby-plugin-polished/issues/1
The issue seems to be that babel-plugin-polished is pegged to v1 of polished: https://github.com/styled-components/babel-plugin-polished/blob/efa054826959d525c58222094a44625830900be8/package.json#L19-L21 That should be updated to v3 or maybe better set in peerDependencies
Look like someone already submitted a pr... https://github.com/styled-components/babel-plugin-polished/pull/8
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?