qduld / vite-plugin-git-revision

Vite plugin that generates VERSION and COMMITHASH files during build based on a local git repository.
8 stars 11 forks source link

TypeError: GitRevision is not a function #7

Open Shinigami92 opened 1 year ago

Shinigami92 commented 1 year ago

I'm using "type": "module" in my package.json and when I look into the node_modules/vite-plugin-git-revision/dist/index.mjs there are require statements 👀

I suggest using tsup

jinixx commented 1 year ago

same problem.

I can see that npm run build uses tsup.

@qduld maybe you should add latest tsup into your dev deps, rebuild and release again.

jinixx commented 1 year ago

Took a deeper look into the issue, when using type module, the cjs was used as the import and require is causing the problem. I am creating a PR for this, please take a look @qduld .

jurosh commented 3 months ago

@qduld Can you update Package or mark it as unmaintained ? Seems like it's not compatible with latest frontend stack.

jvllmr commented 3 weeks ago

I don't know how, but I got it working with this line. This line is rather old though and I don't know why I put it this way in my project. I only realised that this issue still exists when doing some refactors.

// @ts-expect-error Typescript doesn't like this plugin, but it works
GitRevision.default({}),