svelte-check-plugin Svelte Themes

Svelte Check Plugin

Webpack plugin which runs svelte-check before compilation

svelte-check-plugin

This plugin runs svelte-check as part of the webpack build process, and causes the build to fail with proper error reporting when svelte-check fails. This enables proper TypeScript checking of Svelte projects in webpack builds.

Installation

Currently, this plugin only supports npm, as it uses npx to run svelte-check.

npm install --save-dev svelte-check svelte-check-plugin

Usage

The plugin must be specified in your webpack.config.js:

...
const SvelteCheckPlugin = requre("svelte-check-plugin");
...
module.exports = {
    ...
    plugins: {
        ...,
        new SvelteCheckPlugin(),
        ...
    },
    ...
}

If the plugin is working correctly, you should see output similar to the following when webpack compiles your project:

====================================
Loading svelte-check in workspace: [your workspace]
Getting Svelte diagnostics...

====================================
svelte-check found 0 errors, 0 warnings, and 0 hints

Errors will show up over the rendered page during development if any occur.

You can also pass custom arguments to svelte-check if desired:

...
plugins: {
    ...,
    new SvelteCheckPlugin({
        args: ["--fail-on-hints", "--tsconfig", "path/to/tsconfig"]
    }),
    ...
},
...

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes