GithubHelp home page GithubHelp logo

Comments (7)

zheeeng avatar zheeeng commented on June 22, 2024

Could you provide a minimal reproduction repo? It works fine with my case.

from vite-plugin-plain-text.

ninofiliu avatar ninofiliu commented on June 22, 2024

https://github.com/ninofiliu/vite-plugin-plain-text-bug

pnpm run dev

expected behavior: launches vite + vite-plugin-plain-text

actual behavior: this output

> [email protected] 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

from vite-plugin-plain-text.

zheeeng avatar zheeeng commented on June 22, 2024

@ninofiliu I found your package.json has the field "type": "module", it specifies that all module importing is treated as ESM.

from vite-plugin-plain-text.

ninofiliu avatar ninofiliu commented on June 22, 2024

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 ?raw

from vite-plugin-plain-text.

zheeeng avatar zheeeng commented on June 22, 2024

I can declare the CJS exporting and ESM exporting for your issue. But you still have to handle the other CJS-only packages.

from vite-plugin-plain-text.

zheeeng avatar zheeeng commented on June 22, 2024

The latest release v1.3.2 supported your usage.

from vite-plugin-plain-text.

ninofiliu avatar ninofiliu commented on June 22, 2024

It works indeed, awesome!

from vite-plugin-plain-text.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.