question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError on config run (ESM Support)

See original GitHub issue

I have my Vite config set up like so:

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import checker from "vite-plugin-checker";

export default defineConfig({
	plugins: [
		vue(),
		checker({
			typescript: true,
			vueTsc: true,
		}),
	],
});

I’m using this in a Vue 3 project, and my aim is to set up proper type checks separate from VSCode’s since Vite does not intend to support this, even at build time.

After adding the vite-plugin-checker import and calling checker, running vite or vue-tsc results in an error:

failed to load config from /[...]/vite.config.js
error when starting dev server:
TypeError: checker is not a function

As far as I can tell, I’ve imported vite-plugin-checker correctly according to the README documentation. Either I’m missing some obvious thing here, or the export structure is not the same at runtime as its declared type.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
vmarchaudcommented, Dec 13, 2021

I just had the issue, it was because i had configured "type": "module" in your package.json that forces vite to use esm however vite-plugin-checker is still published as CJS

3reactions
fi3eworkcommented, Apr 5, 2022

fixed in 0.4.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest fails to load jest.config.ts in a ESM project using ts-node 10
Bug Report In a project using TypeScript, Jest and setup as ESM (the output of the transpiler is ESM so Node will run...
Read more >
Unable to import ESM .ts module in node - Stack Overflow
I've created a repository with the necessary settings to run esm directly via ts-node or using tsc and running the transpiled esm file...
Read more >
Error: Not Supported - Dave Lage
If you are working with Node.js 12.x which adds full ESModule support, you may find you run into this error. This occurs using...
Read more >
Command Line Interface - webpack
webpack-cli supports configuration in both CommonJS and ESM format, at first it tries to load a configuration using require() , once it fails...
Read more >
Gotchas - Remix
You may run into this strange error in the browser. It almost always means that server code made it into browser bundles. TypeError:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found