Webpack Issues on a Gradle Kotlin/JS project

UPDATE: Adding these lines on a webpack.config.d/config.js file seems to fix the problem (no more ENOENT errors and it hot reloads properly with NPM dependencies):

// noinspection JSUnresolvedVariable
config.devServer = config.devServer || {}; // create devServer in case it is undefined
// noinspection JSUnresolvedVariable
config.devServer.watchOptions = {
    "aggregateTimeout": 5000,
    "poll": 1000
};

My theory is that perhaps the Webpack server doesn’t see the converted JavaScript files just right after they are compiled by the Kotlin compiler?

I saw this workaround on the following post: Kotlin JS + React, unstable building - #3 by Jolanrensen

1 Like