Skip to content

webpack-dev-server not recompiling on scss changes #2062

@dipakchandranp

Description

@dipakchandranp

I am using webpacker for managing javascript, scss and assets in my rails project. I have used following command to run webpack-dev-server.

bin/webpack-dev-server

when ever I am changing javascript file content its recompiling and on page refresh getting updated content. But when I try the same with scss file changes its not updating.

Webpacker dev server is not re-compiling scss files on change.

Following is my webpacker.yml dev_server configuration:

development:
  <<: *default
  compile: false

  # Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    https: false
    host: localhost
    port: 3035
    public: localhost:3035
    hmr: false
    # Inline should be set to true if using HMR
    inline: true
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    headers:
      "Access-Control-Allow-Origin": "*"
    watch_options:
      ignored: /node_modules/

Following is the dependency

"devDependencies": {
    "babel-jest": "^22.4.3",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "husky": "^0.14.3",
    "jest": "^23.4.1",
    "jest-junit": "^4.0.0",
    "prettier": "1.16.4",
    "pretty-quick": "^1.10.0",
    "rails-erb-loader": "^5.5.2",
    "react-test-renderer": "^16.3.2",
    "stylelint": "^9.2.1",
    "stylelint-config-standard": "^18.2.0",
    "stylelint-scss": "^3.5.4",
    "webpack-bundle-analyzer": "^2.12.0",
    "webpack-cli": "^3.3.0",
    "webpack-dev-server": "3.0.0"
  }

Update: 1 ( hmr: true )

I tried to change the dev_server setting for hmr: false to hmr: true and at this time CSS files didn't even loaded. There was no request going in the network for fetching CSS files!!!


I expect on changing the scss file content webpack-dev-server will recompile automatically as it does for js file change, and when I refresh changes will be reflected in the page, without doing manual compilation.

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