TypeError on config run (ESM Support)
See original GitHub issueI 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:
- Created 2 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just had the issue, it was because i had configured
"type": "module"
in your package.json that forces vite to use esm howevervite-plugin-checker
is still published as CJSfixed in 0.4.5