-
Notifications
You must be signed in to change notification settings - Fork 0
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
Package exports { default } #3
Comments
Could you provide a minimal reproduction repo? It works fine with my case. |
https://github.com/ninofiliu/vite-plugin-plain-text-bug pnpm run dev expected behavior: launches vite + vite-plugin-plain-text actual behavior: this output > vite-plugin-plain-text-bug@0.0.0 dev /home/nino/c/vite-plugin-plain-text-bug
> vite
failed to load config from /home/nino/c/vite-plugin-plain-text-bug/vite.config.ts
error when starting dev server:
TypeError: plainText is not a function
at file:///home/nino/c/vite-plugin-plain-text-bug/vite.config.ts.timestamp-1674556087799.mjs:5:13
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
ELIFECYCLE Command failed with exit code 1. if that helps: nino@dell~/c/vite-plugin-plain-text-bugmain$ uname -a
Linux dell 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
nino@dell~/c/vite-plugin-plain-text-bugmain$ node -v
v18.13.0
nino@dell~/c/vite-plugin-plain-text-bugmain$ npm -v
8.19.3
nino@dell~/c/vite-plugin-plain-text-bugmain$ pnpm -v
7.25.1 |
@ninofiliu I found your package.json has the field "type": "module", it specifies that all module importing is treated as ESM. |
as it should be? I don't really understand anyway I found a workaround by not using this plugin entirely and natively using vite's |
I can declare the CJS exporting and ESM exporting for your issue. But you still have to handle the other CJS-only packages. |
The latest release v1.3.2 supported your usage. |
It works indeed, awesome! |
The type defs and the docs asks to do this in
vite.config.ts
:but this is what works for me:
There seems to be a minor issue in your transpilation/commonjs/build pipeline :)
The text was updated successfully, but these errors were encountered: