johnnyreilly / fork-ts-checker-notifier-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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
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.
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.
Depends on version less than 8.0.1
run npm audit
in package dependent on fork-ts-checker-notifier-webpack-plugin
Hi using webpack 4.x I'm getting the warning:
DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks
instead
This is using 1.0.2
Just wondering if there is a planned patch any time soon?
Cheers,
Tom
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) {
I'm sure you're aware, but fork-ts-checker-webpack-plugin just released v 1.0.0
This doesn't seem to work anymore. Just thought I'd give you a heads up.
Currently, this plugin failed on fork-ts-checker-webpack-plugin@5
with error:
Error: Error: TypeError: Cannot read property 'tap' of undefined
On Windows 10 Pro, I'd expect to receive all the error notification sent by ForkTsCheckerNotifierWebpackPlugin.
On Windows 10 Pro, I receive notifications randomly. Most of the times, they are not visible.
vendor/snoreToast
.\SnoreToast.exe -m 'test' -t 'title'
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?
Repository contains both "build and test" and "build, test and publish" workflows.
No workflows available.
Created the issue as a reference for commits.
Files content will be based on https://github.com/TypeStrong/ts-loader/tree/master/.github/workflows
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;
};
Upgraded fork-ts-checker-webpack-plugin
3.1.1
=> 4.0.2
To notify when typescript compile errors
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)
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
I just upgraded to the combination of the latest deps:
Unfortunately, notifications stop working. ๐
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.
It builds
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.
Add this plugin along with ForkTsCheckerWebpackPlugin
n/a
The index.d.ts
isn't being included in the published NPM.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.