vercel / react-tweet

Embed tweets in your React application.

Home Page:https://react-tweet.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while importing react-tweet

bullishgopher opened this issue · comments

Issue

Getting an error while importing react-tweet package.

CSS Modules cannot be imported from within node_modules

image

Versions

"react-tweet": "^3.0.4"
"react": "18.2.0"
"next": "13.0.0"

i do have the same issue with react-xeed

Add this to next.config.js:
transpilePackages: ["react-tweet"],

It works. Thank you

Btw, while building the app, I am getting this type error:

2:23 Error: Unable to resolve path to module 'react-tweet'. import/no-unresolved

image

Ok, thanks. I resolved it by removing all my eslint rules and adding the settings from your project @rsxdalv

Previous:

module.exports = {
  env: {
    browser: true,
    es2021: true,
    mocha: true,
    node: true,
  },
  extends: [
    "next",
    "plugin:@typescript-eslint/recommended",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:import/typescript",
    "prettier",
  ],
  globals: {
    Atomics: "readonly",
    SharedArrayBuffer: "readonly",
  },
  parser: "@typescript-eslint/parser",
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2020,
    sourceType: "module",
  },
  settings: {
    "import/resolver": {
      node: {
        extensions: [".js", ".jsx", ".ts", ".tsx"],
        moduleDirectory: ["node_modules", "."],
      },
    },
  },
  rules: {
    "import/extensions": 0,
    "react/react-in-jsx-scope": 0,
    "react/prop-types": 0,
    "react/jsx-props-no-spreading": 0,
    "react/jsx-filename-extension": [1, { extensions: [".jsx", ".tsx"] }],
    "import/no-extraneous-dependencies": [
      "error",
      {
        devDependencies: ["**/*.test.tsx", "**/*.stories.tsx", "mocks/**/*.ts"],
      },
    ],
  },
  overrides: [
    {
      files: ["hardhat.config.js"],
      globals: { task: true },
    },
    {
      files: ["scripts/**"],
      rules: { "no-process-exit": "off" },
    },
    {
      files: ["hardhat.config.js", "scripts/**", "test/**"],
      rules: { "node/no-unpublished-require": "off" },
    },
  ],
};

Now:

{
  "extends": ["next", "next/core-web-vitals"]
}