Skip to content

Webpack plugin which runs svelte-check before compilation

License

Notifications You must be signed in to change notification settings

zachmatson/svelte-check-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svelte-check-plugin

npm npm

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"]
    }),
    ...
},
...

About

Webpack plugin which runs svelte-check before compilation

Resources

License

Stars

Watchers

Forks

Packages

No packages published