Skip to content

Error: ENOTDIR: not a directory, scandir '/xx/contributing.md' #462

@kingller

Description

@kingller

Current behavior

When I upgrade fork-ts-checker-webpack-plugin from 4.1.4 to 5.0.4, the webpack compiled error happens.

Here is the error,

Error: ENOTDIR: not a directory, scandir '/xx/contributing.md'
    at Object.readdirSync (fs.js:854:3)
    at readDir (/xx/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/file-system/RealFileSystem.js:56:69)
    at Object.readDir (/xx/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/file-system/RealFileSystem.js:145:20)
    at readDir (/xx/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/file-system/PassiveFileSystem.js:53:42)
    at Object.readDir (/xx/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/file-system/PassiveFileSystem.js:100:20)
    at updateDirectorySnapshot (/xx/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js:86:43)
    at Object.watchDirectory (/xx/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js:150:13)
    at watchDirectory (/xx/node_modules/typescript/lib/typescript.js:99350:21)
    at watchDirectory (/xx/node_modules/typescript/lib/typescript.js:99339:24)
    at Object.compilerHost.watchDirectoryOfFailedLookupLocation (/xx/node_modules/typescript/lib/typescript.js:105647:96)

Expected behavior

I use markdown-loader and html-loader to load the contributing.md, not typescript,
the error should not occur.
It's OK at version 5.0.2, but not after it.

Steps to reproduce the issue

code

import contributingDoc from '../../../CONTRIBUTING.md';

webpack.config.js

{
    // ...
   module: {
        rules: [
            {
                test: /\.[jt]sx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
            },
            {
                test: /\.md$/,
                use: [
                    {
                        loader: 'html-loader'
                    },
                    {
                        loader: 'markdown-loader'
                    }
                ]
            }
        ]
    },
    plugins: [
        // ...
        new ForkTsCheckerWebpackPlugin({
            async: false
        }),
    ]
}

tsconfig.json

{
    "compilerOptions": {
        "outDir": "./dist/",
        "sourceMap": true,
        "noImplicitAny": true,
        "strictNullChecks": false,
        "module": "commonjs",
        "target": "ESNext",
        "jsx": "react",
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "moduleResolution": "node",
        "allowJs": false,
        "baseUrl": "."
    },
    "include": [
        "./src/**/*",
        "./example/**/*"
    ]
}

babel.config.js

module.exports = {
    presets: ['@babel/preset-typescript', '@babel/preset-react', '@babel/preset-env', 'mobx'],
    plugins: [
        ['@babel/plugin-transform-typescript', { allowNamespaces: true }],
        // Stage 0
        '@babel/plugin-proposal-function-bind',

        // Stage 1
        '@babel/plugin-proposal-export-default-from',
        '@babel/plugin-proposal-logical-assignment-operators',
        ['@babel/plugin-proposal-optional-chaining', { loose: false }],
        ['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }],
        ['@babel/plugin-proposal-nullish-coalescing-operator', { loose: false }],
        '@babel/plugin-proposal-do-expressions',

        // Stage 2
        ['@babel/plugin-proposal-decorators', { legacy: true }],
        '@babel/plugin-proposal-function-sent',
        '@babel/plugin-proposal-export-namespace-from',
        // '@babel/plugin-proposal-numeric-separator',
        '@babel/plugin-proposal-throw-expressions',
        '@babel/plugin-proposal-object-rest-spread',

        // Stage 3
        '@babel/plugin-syntax-dynamic-import',
        '@babel/plugin-syntax-import-meta',
        ['@babel/plugin-proposal-class-properties', { loose: true }],
        // '@babel/plugin-proposal-json-strings',

        // Other
        '@babel/plugin-transform-runtime',
        '@babel/plugin-transform-modules-commonjs',
        'jsx-control-statements'
    ]
}

Issue reproduction repository

Environment

  • fork-ts-checker-webpack-plugin: [version from the package.json] 5.0.4
  • typescript: [version from the package.json] 3.9.5
  • eslint: [version from the package.json] 6.8.0
  • webpack: [version from the package.json] 4.43.0
  • os: [e.g. Ubuntu 19.04] macOS 10.15.5

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions