Skip to content

Using @import ~ forces file to be always rebuilt in watch mode #357

Closed
@Kukkimonsuta

Description

@Kukkimonsuta
  • Operating System: Windows 10
  • Node Version: v12.13.0
  • NPM Version: 6.12.0
  • webpack Version: 4.43.0
  • less-loader Version: 6.1.0

When using @import '~xxx' to resolve a module path to a less file webpack --watch will always include it in subsequent rebuilds despite the file not being changed. This behavior doesn't occur when going to node modules directly, for instance @import '../node_modules/xxx'.

Expected Behavior

When using @import '~bootstrap-less-port/less/bootstrap.less'; and webpack --watch, less files aren't rebuilt when updating unrelated files.

Actual Behavior

When using @import '~bootstrap-less-port/less/bootstrap.less'; and webpack --watch, less files are rebuilt when updating unrelated files.

Code

https://github.com/Kukkimonsuta/test-webpack-watch/blob/master/webpack.config.js
https://github.com/Kukkimonsuta/test-webpack-watch/blob/master/src/styles.less

How Do We Reproduce?

Clone repository https://github.com/Kukkimonsuta/test-webpack-watch
Run npm i
Run webpack --watch --progress --mode development
Edit src/index.js
Watch src/styles.less being rebuilt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions