Giter Site home page Giter Site logo

fork-ts-checker-notifier-webpack-plugin's People

Contributors

alesmenzel avatar bbosman avatar cdeutsch avatar deftomat avatar dependabot[bot] avatar developer-lindner avatar hisuwh avatar johnnyreilly avatar madaz avatar n0v1 avatar rolandisimo avatar sakit0 avatar sanex3339 avatar trevorsayre avatar wojtasik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fork-ts-checker-notifier-webpack-plugin's Issues

forkTsCheckerWebpackPlugin.getCompilerHooks is not a function

This is my package.json

"fork-ts-checker-notifier-webpack-plugin": "^1.0.0",
"fork-ts-checker-webpack-plugin": "^1.0.2",

and then webpack.dev.js

 new ForkTsCheckerWebpackPlugin({
      typescript: resolve.sync('typescript', {
        basedir: paths.appNodeModules,
      }),
      measureCompilationTime: true,
      async: true, // in order to show tslint error. [improvement] Need to use pre loader
      useTypescriptIncrementalApi: true,
      checkSyntacticErrors: true,
      tsconfig: paths.appTsConfig,
      tslint: paths.appTsLint,
      reportFiles: [
        '**',
        '!**/*.json',
        '!**/__tests__/**',
        '!**/?(*.)(spec|test).*',
        '!**/src/setupProxy.*',
        '!**/src/setupTests.*',
      ],
      watch: paths.appSrc,
      silent: false,
      // The formatter is invoked directly in WebpackDevServerUtils during development
      formatter: typescriptFormatter,
}),
new ForkTsCheckerNotifierWebpackPlugin({ excludeWarnings: true }),

but, I get the error

Something went wrong in accessing the hooks.
Most likely the order of plugins is wrong.
Check the documentation for "fork-ts-checker-notifier-webpack-plugin"


Failed to compile.

Error: TypeError: forkTsCheckerWebpackPlugin.getCompilerHooks is not a function

Crashes on webpack 4.x

When trying to use the plugin in its 0.4.0 version with webpack 4, it crashes with the following stack

/Users/damien/Documents/Git/WRK/front-client/node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:46
      return diagnostic.isErrorSeverity();
                        ^

TypeError: Cannot read property 'isErrorSeverity' of undefined
    at /Users/damien/Documents/Git/WRK/front-client/node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:46:25
    at Array.find (native)
    at module.exports.ForkTsCheckerNotifierWebpackPlugin.buildNotification (/Users/damien/Documents/Git/WRK/front-client/node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:45:41)
    at module.exports.ForkTsCheckerNotifierWebpackPlugin.compilationDone (/Users/damien/Documents/Git/WRK/front-client/node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:90:27)
    at SyncHook.eval [as call] (eval at create (/Users/damien/Documents/Git/WRK/front-client/node_modules/tapable/lib/HookCodeFactory.js:17:12), <anonymous>:7:1)
    at SyncHook.lazyCompileHook [as _call] (/Users/damien/Documents/Git/WRK/front-client/node_modules/tapable/lib/Hook.js:35:21)
    at ForkTsCheckerWebpackPlugin.handleServiceMessage (/Users/damien/Documents/Git/WRK/front-client/node_modules/fork-ts-checker-webpack-plugin/lib/index.js:424:54)
    at ChildProcess.<anonymous> (/Users/damien/Documents/Git/WRK/front-client/node_modules/fork-ts-checker-webpack-plugin/lib/index.js:382:70)
    at ChildProcess.emit (events.js:160:13)
    at emit (internal/child_process.js:790:12)

From what I could see by adding logs to the file directly, it seems like this method receives undefined, undefined as its argument, making everything crash down the line.

Downgrading to 0.2.0 "fixes" the crashes but no notifications are displayed at all so it kinda defeats the purpose.

Glad to provide more informations if needed.

Upgrade node-notifier or make it a peer dependency

Expected Behaviour

node-notifier needs to be updated to 8.0.1 or later to address: GHSA-5fw9-fq32-wv5p
Or it could probably be made a peer dependency.

Actual Behaviour

Depends on version less than 8.0.1

Steps to Reproduce the Problem

run npm audit in package dependent on fork-ts-checker-notifier-webpack-plugin

Prop excludeWarnings: true does not work.

The property excludeWarnings does not work, and I receive a notification that there is an error even when it is set to true.

Looking at the code base the problem is at lines 49-63. Printing out an error happens before checking if the prop has been set. It seems there is no way to disable the error notification.

    if (firstError) {
      this.lastBuildSucceeded = false;

      return {
        title: util.format(
          '%s%s',
          this.titlePrefix,
          'Error in ' + path.basename(firstError.file || '')
        ),
        message: firstError.content,
        icon: path.join(__dirname, 'images/error.png')
      };
    }

    if (firstWarning && !this.options.excludeWarnings) {

SnoreToast's notifications work randomly

Expected Behaviour

On Windows 10 Pro, I'd expect to receive all the error notification sent by ForkTsCheckerNotifierWebpackPlugin.

Actual Behaviour

On Windows 10 Pro, I receive notifications randomly. Most of the times, they are not visible.

Steps to Reproduce the Problem

  • using PowerShell, go to vendor/snoreToast
  • run .\SnoreToast.exe -m 'test' -t 'title'
  • no notification visible

I am using:
Microsoft Windows
Version 1903 (OS Build 18362.476)

On the other hand, I tried [email protected]. Running it from command line worked 10 times out of 10.

SnoreToast.exe version used in this repo: 0.5.2.
Maybe it would be enough to update snoretoast.exe to the newest version?

Does not work w/ latest plugin and latest webpack

ERR! Error: Error: TypeError: forkTsCheckerWebpackPlugin.getCompilerHooks is not a function
ERR!     at ForkTsCheckerNotifierWebpackPlugin.apply (/Users/uri/Documents/web-gen3/node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:68:23)
ERR!     at webpack (/Users/uri/Documents/web-gen3/node_modules/@storybook/core/node_modules/webpack/lib/webpack.js:47:13)
ERR!     at options.ignorePreview.then.previewConfig (/Users/uri/Documents/web-gen3/node_modules/@storybook/core/dist/server/dev-server.js:113:50)
ERR!     at process._tickCallback (internal/process/next_tick.js:68:7)
ERR!  { Error: Error: TypeError: forkTsCheckerWebpackPlugin.getCompilerHooks is nota function
ERR!     at ForkTsCheckerNotifierWebpackPlugin.apply (/Users/uri/Documents/web-gen3/node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:68:23)
ERR!     at webpack (/Users/uri/Documents/web-gen3/node_modules/@storybook/core/node_modules/webpack/lib/webpack.js:47:13)
ERR!     at options.ignorePreview.then.previewConfig (/Users/uri/Documents/web-gen3/node_modules/@storybook/core/dist/server/dev-server.js:113:50)
ERR!     at process._tickCallback (internal/process/next_tick.js:68:7)
ERR!   stack:
ERR!    'Error: Error: TypeError: forkTsCheckerWebpackPlugin.getCompilerHooks is not a function\n    at ForkTsCheckerNotifierWebpackPlugin.apply (/Users/uri/Documents/web-gen3/node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:68:23)\n    at webpack (/Users/uri/Documents/web-gen3/node_modules/@storybook/core/node_modules/webpack/lib/webpack.js:47:13)\n    at options.ignorePreview.then.previewConfig (/Users/uri/Documents/web-gen3/node_modules/@storybook/core/dist/server/dev-server.js:113:50)\n    at process._tickCallback (internal/process/next_tick.js:68:7)' }

webpack.config:

// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { plugins, presets } = require('../babel.config');

module.exports = ({ config }) => {
  config.module.rules.push({
    test: /\.(ts|tsx)$/,
    exclude: ['/node_modules/'],
    use: [
      {
        loader: require.resolve('babel-loader'),
        options: {
          plugins,
          presets,
        },
      },
      {
        loader: require.resolve('@storybook/addon-storysource/loader'),
        options: { parser: 'typescript' },
      },
      {
        loader: require.resolve('react-docgen-typescript-loader'),
        options: {
          skipPropsWithoutDoc: false,
          tsconfigPath: path.join(__dirname, '../tsconfig.json'),
        },
      },
    ],
  });
  config.resolve.extensions.push('.ts', '.tsx');
  config.plugins.push(
    new ForkTsCheckerWebpackPlugin({
      tsconfig: path.join(__dirname, '../tsconfig.json'),
    }),
    new ForkTsCheckerNotifierWebpackPlugin({ excludeWarnings: true }),
  );
  return config;
};

TypeError: diagnostic.isErrorSeverity is not a function

Expected Behaviour

Upgraded fork-ts-checker-webpack-plugin 3.1.1 => 4.0.2

To notify when typescript compile errors

Actual Behaviour

Added some typescript breaking code to test upgrade

const b: boolean = 'true';
(node:36892) UnhandledPromiseRejectionWarning: TypeError: diagnostic.isErrorSeverity is not a function
    at [redacted]\node_modules\fork-ts-checker-notifier-webpack-plugin\index.js:26:75
    at Array.find (<anonymous>)
    at ForkTsCheckerNotifierWebpackPlugin.buildNotification ([redacted]\node_modules\fork-ts-checker-notifier-webpack-plugin\index.js:26:45)
    at ForkTsCheckerNotifierWebpackPlugin.compilationDone ([redacted]\node_modules\fork-ts-checker-notifier-webpack-plugin\index.js:9:37)
    at SyncHook.eval [as call] (eval at create ([redacted]\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
    at ForkTsCheckerWebpackPlugin.handleServiceMessage ([redacted]\node_modules\fork-ts-checker-webpack-plugin\lib\index.js:395:36)
    at [redacted]\node_modules\fork-ts-checker-webpack-plugin\lib\index.js:254:35
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:36892) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

Steps to Reproduce the Problem

node 12.14.1
windows 10 1909

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
@typescript-eslint/[email protected]
@typescript-eslint/[email protected]

  // webpack.config.js

  plugins: [
     new ForkTsCheckerWebpackPlugin({
       async: true,
       eslint: true,
       useTypescriptIncrementalApi: true,
      }),
      new ForkTsCheckerNotifierWebpackPlugin({
        excludeWarnings: true,
        skipSuccessful: true,
      }),
  ]
npx webpack-dev-server

Location of a Minimal Repository that Demonstrates the Issue.

Build error on M3 Mac - Error: spawn Unknown system error -86

I've not looked into this - just thought you might want to know that there might be a problem with M3 - might be my setup as I'm new to the repo I'm working on, but also might be something to do with M3. If I work it out I'll update.

Expected Behaviour

It builds

Actual Behaviour

Throws this:

node:internal/child_process:421
    throw new ErrnoException(err, 'spawn');
          ^

Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at Object.execFile (node:child_process:351:17)
    at module.exports.fileCommandJson (.../node_modules/node-notifier/lib/utils.js:88:13)
    at NotificationCenter.notifyRaw (.../node_modules/node-notifier/notifiers/notificationcenter.js:81:11)
    at ForkTsCheckerNotifierWebpackPlugin.compilationDone (.../node_modules/fork-ts-checker-notifier-webpack-plugin/index.js:14:41)
    at Hook.eval [as call] (eval at create (.../node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Hook.CALL_DELEGATE [as _call] (.../node_modules/tapable/lib/Hook.js:14:14)
    at .../node_modules/fork-ts-checker-webpack-plugin/lib/hooks/tap-done-to-async-get-issues.js:58:31
    at Generator.next (<anonymous>) {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}

Node.js v22.0.0
error Command failed with exit code 1.

Steps to Reproduce the Problem

Add this plugin along with ForkTsCheckerWebpackPlugin

Location of a Minimal Repository that Demonstrates the Issue.

n/a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.