Skip to content

Can't use styled components as selectors #37

@tpict

Description

@tpict

I'm having an issue where my compiled JS throws an error if I attempt to use components as selectors: Component selectors can only be used in conjunction with babel-plugin-emotion. My ts-loader configuration looks like this:

      {
        test: /\.tsx?/,
        use: [
          {
            loader: "ts-loader",
            options: {
              transpileOnly: true,
              getCustomTransformers: () => ({
                before: [
                  createEmotionPlugin({
                    sourcemap: true,
                    autoLabel: true,
                    labelFormat: "[local]",
                    autoInject: true,
                  }),
                ],
              }),
              compilerOptions: {
                jsxFactory: "jsx",
              },

              onlyCompileBundledFiles: true,
            },
          },
        ],
      },

I can use the css prop without including the jsx pragma, so it seems like the code transform is occurring, but Emotion itself doesn't seem satisfied. I'm using versions:

    "@emotion/core": "^10.0.22",
    "@emotion/styled": "^10.0.23",

Any ideas what I'm doing incorrectly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions