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

Cannot read properties of undefined (reading '__esModule') #145

Open
Sambuxc opened this issue Jun 30, 2023 · 0 comments
Open

Cannot read properties of undefined (reading '__esModule') #145

Sambuxc opened this issue Jun 30, 2023 · 0 comments

Comments

@Sambuxc
Copy link

Sambuxc commented Jun 30, 2023

Hi

I'm using the template-vite-vanilla-tailwind-v3 package from vitawind.

I'm having this issue when I try to import some packages. I have tried it with a jquery package and slick-carousel.

Console log error looks returns:
Uncaught TypeError: Cannot read properties of undefined (reading '__esModule')

Clicking on the file/line I can see why its a problem but not sure how to correct it:
import __vite__cjsImport0_jquery from "/node_modules/.vite/deps/jquery.js?v=17be8314"; const jQuery = __vite__cjsImport0_jquery.__esModule ? __vite__cjsImport0_jquery.default : __vite__cjsImport0_jquery

import __vite__cjsImport1_slickCarousel from "/node_modules/.vite/deps/slick-carousel.js?v=17be8314"; const slick = __vite__cjsImport1_slickCarousel.__esModule ? __vite__cjsImport1_slickCarousel.default : __vite__cjsImport1_slickCarousel

My package.json file looks like this:

{
  "version": "1.0.0",
  "scripts": {
    "dev": "cross-env TAILWIND_MODE=watch vite",
    "build": "cross-env TAILWIND_MODE=build vite build",
    "serve": "vite preview"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.14",
    "cross-env": "^7.0.3",
    "postcss": "^8.4.24",
    "prettier": "^2.7.1",
    "prettier-plugin-tailwindcss": "^0.1.5",
    "vitawind": "^2.2.4",
    "vite": "^3.1.0"
  },
  "dependencies": {
    "alpinejs": "^3.12.2",
    "jquery": "^3.7.0",
    "sass": "^1.63.6",
    "slick-carousel": "^1.8.1"
  }
}

In terms of config files I have the following

  • postcss.config.js
  • tailwind.config.js

Will I need to manually config the vite.config.js file for this esModule to be fixed?

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