Skip to content

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

@Sambuxc

Description

@Sambuxc

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions