Skip to content

Failing with webpack --watch on file change #155

@bitspook

Description

@bitspook

Here's my webpack.config:

    module: {
        loaders: [
            {
                test: /\.js$/,
                include: [
                    path.resolve(__dirname, 'src'),
                ],
                loader: 'babel',
            },
            {
                test: /\.ts(x?)$/,
                include: [
                    path.resolve(__dirname, 'src'),
                ],
                loaders: [
                    'babel',
                    'ts-loader',
                ],
            },
.
.
.
    resolve: {
        extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
    },

And this is tsconfig.json:

{
    "compilerOptions": {
        "target": "es2015",
        "module": "es2015",
        "sourceMap": true,
        "allowJs": true,
        "jsx": "preserve",
        "watch": true
    },
    "exclude": [
        "node_modules"
    ]
}

Typescript compiles the app first time just fine, but when I change something in the code, it fails and crashes with this error:

File changed: src/endpoint/static/app.css
/Users/channi/Documents/Work/Dear-Diary/node_modules/ts-loader/index.js:350
        var mtimes = watching.compiler.watchFileSystem.watcher.mtimes;
                                                              ^

TypeError: Cannot read property 'mtimes' of undefined
    at Compiler.<anonymous> (/Users/channi/Documents/Work/Dear-Diary/node_modules/ts-loader/index.js:350:63)
    at Compiler.next (/Users/channi/Documents/Work/Dear-Diary/node_modules/tapable/lib/Tapable.js:69:14)
    at Compiler.invalidAsyncPlugin (/Users/channi/Documents/Work/Dear-Diary/node_modules/webpack-dev-middleware/middleware.js:79:3)
    at Compiler.applyPluginsAsync (/Users/channi/Documents/Work/Dear-Diary/node_modules/tapable/lib/Tapable.js:71:13)
    at Watching._go (/Users/channi/Documents/Work/Dear-Diary/node_modules/webpack/lib/Compiler.js:44:16)
    at Watching.invalidate (/Users/channi/Documents/Work/Dear-Diary/node_modules/webpack/lib/Compiler.js:108:8)
    at Watching.<anonymous> (/Users/channi/Documents/Work/Dear-Diary/node_modules/webpack/lib/Compiler.js:93:8)
    at onTimeout [as _onTimeout] (/Users/channi/Documents/Work/Dear-Diary/node_modules/webpack/lib/node/OldNodeWatchFileSystem.js:234:3)
    at Timer.listOnTimeout (timers.js:92:15)

I am trying out typescript and ts-loader for first time, so I am not sure if this is something I am doing wrong or if this is a bug. I've tried googling, read through many boilerplates and such configs, but I can't figure out if it is me doing something wrong. Nothing I have done so far could solve this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions