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

Not working when used with parcel v2 #595

Open
hbarcelos opened this issue Oct 19, 2021 · 0 comments
Open

Not working when used with parcel v2 #595

hbarcelos opened this issue Oct 19, 2021 · 0 comments

Comments

@hbarcelos
Copy link

I am trying to use this plugin with parcel v2 but I keep getting the following error:

ReferenceError: Layout is not defined

The relevant config files are:

.parcelrc

{
  "extends": "@parcel/config-default",
  "transformers": {
    "*.svg": ["@parcel/transformer-svgo", "@parcel/transformer-svg-react", "@parcel/transformer-js"]
  }
}

.babelrc

{
  "plugins": [
    [
      "import",
      {
        "libraryName": "antd",
        "style": "css"
      },
      "antd"
    ]
  ]
}

If I install @babel/cli and run babel myFile.js with

.babelrc

{
  "presets": ["@babel/preset-react"],
  "plugins": [
    "@babel/plugin-syntax-jsx",
    [
      "import",
      {
        "libraryName": "antd",
        "style": "css"
      },
      "antd"
    ]
  ]
}

then the component is still imported.

But if I remove the "presets" line, then the import is removed even though there is a JSX element that references it.

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

1 participant