https://github.com/zachmatson/svelte-check-plugin
Webpack plugin which runs svelte-check before compilation
https://github.com/zachmatson/svelte-check-plugin
Last synced: about 2 months ago
JSON representation
Webpack plugin which runs svelte-check before compilation
- Host: GitHub
- URL: https://github.com/zachmatson/svelte-check-plugin
- Owner: zachmatson
- License: mit
- Created: 2022-01-11T16:46:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-17T01:46:57.000Z (over 2 years ago)
- Last Synced: 2025-02-25T08:47:09.538Z (3 months ago)
- Language: JavaScript
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# svelte-check-plugin
[](https://www.npmjs.com/package/svelte-check-plugin)
[](https://www.npmjs.com/package/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`.
```sh
npm install --save-dev svelte-check svelte-check-plugin
```## Usage
The plugin must be specified in your `webpack.config.js`:
```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:
```sh
====================================
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:
```js
...
plugins: {
...,
new SvelteCheckPlugin({
args: ["--fail-on-hints", "--tsconfig", "path/to/tsconfig"]
}),
...
},
...
```