styled-components / babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components
MIT License
1.08k stars 141 forks source link

Plugin no longer transforming codebase as of v1.10.3 #243

Open frisbee09 opened 5 years ago

frisbee09 commented 5 years ago

Just updated from v1.10.0 to v1.10.6 and finding the plugin no longer transforming any of my code. I managed to get it to kick back in by downgrading to v1.10.2.

My snapshots capture this by failing with these kinds of mismatches,

 -           "componentId": "ComponentName___default-sc-15na3pr-0", /// v1.10.2 with RHL
 +           "componentId": "ComponentName-sc-15na3pr-0", //v1.10.2 without RHL
 +           "componentId": "sc-bdVaJa", //v1.10.3+

If it helps debug the issue, I can confirm that the ___default injection appears when react-hot-loader/babel is enabled. Removing react-hot-loader from the plugin chain doesn't make babel-plugin-styled-components@1.10.6 transform any of my code, however.

Babel configuration looks like this:

{
    "plugins": [
        "babel-plugin-styled-components",
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-transform-runtime",
        "@babel/plugin-transform-object-assign",
        "@babel/plugin-proposal-throw-expressions",
        "@babel/plugin-transform-react-constant-elements",
        "react-hot-loader/babel"
    ],
    "presets": [
        [
            "@babel/preset-env",
            {
                "targets": {
                    "ie": "11"
                }
            }
        ],
        "@babel/preset-react",
        "@babel/preset-typescript"
    ]
}

Sorry if this is a bad bug report? I'm not used to opening GitHub issues. Could this be related to @babel/plugin-proposal-dynamic-import becoming part of @babel/core as of v7.5.0?

AndyBan commented 5 years ago

👍 We are seeing the same issue

ppiyush13 commented 5 years ago

Same issue with version 1.10.6, everything works with 1.10.5. .babelrc content:

{
    "presets": ["@babel/env"],
    "plugins": [
        [
            "babel-plugin-styled-components",
            {
                "minify": true,
                "transpileTemplateLiterals": true,
                "fileName": false,
                "displayName": true,
                "ssr": false
            }
        ]
    ]
}
Shakeskeyboarde commented 4 years ago

Same issue here.

frisbee09 commented 4 years ago

There is a potential fix for you in #261 @ChrisAckerman @AndyBan @ppiyush13