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

'default' is not exported by..." TypeError: ViteRequireContext is not a function #54

Open
xiangnanscu opened this issue Apr 10, 2024 · 3 comments

Comments

@xiangnanscu
Copy link

xiangnanscu commented Apr 10, 2024

Versions

  • originjs: v1.0.9
  • node: v20.14.0

Reproduction

Additional Details

Steps to reproduce

in vite.config.ts:

import ViteRequireContext from "@originjs/vite-plugin-require-context";
ViteRequireContext()
// however, ViteRequireContext .default() is OK. 

What is Expected?

What is actually happening?

failed to load config from /root/jaqn/vite.config.ts
error during build:
TypeError: ViteRequireContext is not a function
  
@xiangnanscu xiangnanscu changed the title 'default' is not exported by..." 'default' is not exported by..." TypeError: ViteRequireContext is not a function Apr 10, 2024
@LiquidITGuy
Copy link

LiquidITGuy commented May 16, 2024

Same problem here with same versions

@lblblb7777
Copy link

Same problem here with same versions
vite version: 5.2.11

@erikjuhani
Copy link

erikjuhani commented Sep 27, 2024

I solved this in a hacky way by invoking default:

// @ts-expect-error https://github.com/originjs/vite-plugins/issues/54
ViteRequireContext.default(),

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

4 participants