1.2.2 • Published 5 years ago

@react-app/watcher-webpack-plugin v1.2.2

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

watcher-webpack-plugin

Webpack plugin to watch files with chokidar using glob. Runs webpack's subcompiler on file change if it is not already watched by webpack, runs callback on delete. This plugin is mainly used to enhance developer experience when generating typings on the fly when creating new files (.module.css, .graphql, ...) so you can use typings straight away when writing new TS files.

npm i @react-app/watcher-webpack-plugin
const WatcherWebpackPlugin = require('@react-app/watcher-webpack-plugin');

config.plugins = [
    ...
    new WatcherWebpackPlugin('src/**/*.(module.css|graphql)' ,{
        onRemove: (file) => Promise.all([
          unlinkIfExists(`${file}.d.ts`),
          unlinkIfExists(`${file}.types.ts`),
        ]),
    }),
];