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

TypeError: cheerio.load is not a function #751

Open
sawanstack opened this issue Oct 24, 2023 · 0 comments
Open

TypeError: cheerio.load is not a function #751

sawanstack opened this issue Oct 24, 2023 · 0 comments

Comments

@sawanstack
Copy link

sawanstack commented Oct 24, 2023

I have insalled both postlight parser and cheerio.
In a parallel repository, both work fine.

I am using react and vite to create a chrome extension that needs to use this.
cheerio works fine in my react component.

as soon as I call parser.parse, it gives me the error.

import cheerio from 'cheerio';
import Parser from '@postlight/parser';

const $ = cheerio.load(html);
//Works

const data = await Parser.parse(document.location.href,{html});
//Error

vite.config.js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
build: {
minify:false,
rollupOptions: {
output: {
entryFileNames: react/[name].js,
chunkFileNames: react/[name].js,
assetFileNames: react/[name].[ext],
},
},
},
})

Current Behavior

Steps to Reproduce

Detailed Description

Possible Solution

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