Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wesm87/validate-syntax-webpack-plugin
A Webpack plugin to validate the syntax in your bundles
https://github.com/wesm87/validate-syntax-webpack-plugin
webpack webpack-plugin
Last synced: 4 days ago
JSON representation
A Webpack plugin to validate the syntax in your bundles
- Host: GitHub
- URL: https://github.com/wesm87/validate-syntax-webpack-plugin
- Owner: wesm87
- License: mit
- Created: 2018-03-19T22:01:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:57:30.000Z (almost 2 years ago)
- Last Synced: 2024-04-07T00:24:34.414Z (8 months ago)
- Topics: webpack, webpack-plugin
- Language: TypeScript
- Size: 792 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Validate Syntax Webpack Plugin
A Webpack plugin to validate the syntax in your bundles. Uses
[Acorn](https://github.com/acornjs/acorn) internally.## Why?
The motivation for writing this plugin was that I had an issue in a React app where some ES6
code was making its way into the app bundle, which broke the site in Internet Explorer. Upon
investigation I discovered that the code in question was coming from one of the third-party
packages I was using that was written in ES6 but was not transpiled before shipping. I wanted
my build process to throw an error if any invalid code made it into the compiled bundle but
I couldn't find a plugin to do that, so I created one.## Requirements
- Node >= 8.0.0
- Webpack 2, 3, or 4## Install
```sh
// via yarn
yarn add -D validate-syntax-webpack-plugin// via npm
npm install -D validate-syntax-webpack-plugin
```## Usage
**webpack.config.js**
```js
const ValidateSyntaxWebpackPlugin = require('validate-syntax-webpack-plugin');module.exports = {
plugins: [
new ValidateSyntaxWebpackPlugin({ /* plugin options */ }),
],
};
```### Options
The plugin currently takes the following options:
Note: `MatchPattern` is an alias type for `RegExp | string | RegExp[] | string[]`
|Name|Type|Default|Description|
|:--:|:--:|:-----:|:----------|
|**`ecmaVersion`**|`number`|`5`|The ECMAScript version to validate against|
|**`sourceType`**|`string`|`"script"`|Set to `"module"` if you're compiling to ES modules instead of CommonJS|
|**`test`**|`MatchPattern`|`/\\.js$/i`|Test to match files against|
|**`include`**|`MatchPattern`|`null`|Files to include|
|**`exclude`**|`MatchPattern`|`null`|Files to exclude|