Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack watch mode not working.... #2949

Closed
mastrauckas opened this issue Sep 3, 2016 · 31 comments

Comments

@mastrauckas
Copy link

@mastrauckas mastrauckas commented Sep 3, 2016

General Information:
webpack version: 1.13.2
OS: Windows 10 Anniversary Update and webpack is running in Windows Subsystem for Linux(The new bash on Ubuntu)

I"m trying to run webpack in watch mode by using:

webpack --watch

and by also setting watch mode in config:

context: path.join(__dirname, '/src'),
devtool: debug ? 'inline-sourcemap' : null,
entry: './js-src/scripts.js',
watch: true,
module: {

All webpack does is run the transpiler and exit.
Example of output when running watch mode:

Hash: 045070ba2ed9ce40edf7
Version: webpack 1.13.2
Time: 2146ms
         Asset     Size  Chunks             Chunk Names
scripts.min.js  1.89 MB       0  [emitted]  main
    + 172 hidden modules

I'm not sure what i'm doing incorrect?

@TheLarkInn

This comment has been minimized.

Copy link
Member

@TheLarkInn TheLarkInn commented Sep 4, 2016

  1. Could you please first post your question on stack overflow before you post here. Our issue template clearly encourages submitters to submit their questions/support there so that you have more accessible support. When you have submitted the question to stackoverflow, please provide the link there for easier access.
  2. Could you please provide your full webpack configuration.
@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 4, 2016

Since I think it's a possible issue I think this is the appropriate place because it might be an issue.: Full webpack config:

var debug = process.env.NODE_ENV !== 'production';
var path = require('path');
var webpack = require('webpack');

module.exports = {
  context: path.join(__dirname, '/src'),
  devtool: debug ? 'inline-sourcemap' : null,
  entry: './js-src/scripts.js',
  watch: true,
  module: {
    loaders: [
      {
        test: /.js?$/,
        exclude: /(node_modules)|(bower_components)/,
        loader: 'babel-loader',
        query: {
          presets: ['react', 'es2015', 'stage-0']
        }
      }
    ]
  },
  output: {
    path: path.join(__dirname, '/src/wwwroot/static/js'),
    filename: 'scripts.min.js'
  },
  plugins: debug ? [] : [
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
  ],
};

Thanks!

@sokra

This comment has been minimized.

Copy link
Member

@sokra sokra commented Sep 5, 2016

OS: Windows 10 Anniversary Update and webpack is running in Windows Subsystem for Linux(The new bash on Ubuntu)

Probably chokidar has an issue with this...

@TheLarkInn

This comment has been minimized.

Copy link
Member

@TheLarkInn TheLarkInn commented Sep 5, 2016

Their issue list has a few maybe related things. @mastrauckas is there any additional details that you think might be beneficial that we (you could also as well) could submit to @paulmillr?

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 5, 2016

@TheLarkInn I have no additional information. Should I just put a ticket on their issue list and refer back to this ticket?

@paulmillr

This comment has been minimized.

Copy link

@paulmillr paulmillr commented Sep 5, 2016

@mastercactapus I would be glad to help you (i've created chokidar). Are you able to set up a demo git repo that makes it easy to replicate the issue?

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 5, 2016

@paulmillr I can pull down any demo you want me too from git and run it. I might not be able to do it until tomorrow though.

@TheLarkInn

This comment has been minimized.

Copy link
Member

@TheLarkInn TheLarkInn commented Sep 6, 2016

@paulmillr thank you very much!!

@rafde

This comment has been minimized.

Copy link
Contributor

@rafde rafde commented Sep 6, 2016

@mastrauckas I think you have a typo
devtool: debug ? 'inline-sourcemap' : null,
should be
devtool: debug ? 'inline-source-map' : null,

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 6, 2016

@rafde Thanks for noticing that. I'll fix that tonight and see if it fixes the issue.

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 6, 2016

@rafde That didn't fix the issue. @paulmillr what did you want me to demo?

@paulmillr

This comment has been minimized.

Copy link

@paulmillr paulmillr commented Sep 6, 2016

Would be great to have a demo repository where i'll be able to reproduce the issue simply without hassle and messing with configs.

@eteeselink

This comment has been minimized.

Copy link

@eteeselink eteeselink commented Sep 7, 2016

@paulmillr FWIW, I experience the exact same thing on a number of webpack projects in Windows Subsystem for Linux, which have wildly varying configs. Therefore I'm not sure prepping any particular repo will help.

All that said, I share Sokra's hunch that this is either in chokidar or simply a core bug in this fancy new Windows feature. So I cloned chokidar, ran tests, got 19 passes and 76 failures (gist: https://gist.github.com/eteeselink/0c7394eab588d0851d8633cc0ade7c3f). Running the same tests on plain windows gives 0 test failures. Node 6.5.0 on both "platforms". Removed node_modules and re-did npm install before running tests on either system.

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 7, 2016

@paulmillr like @eteeselink said it might be an issue in the Windows Subsystem for Linux,. Here is a demo project https://github.com/mastrauckas/webpack-issue that is having the issue. I you need me to do anything else please let me know.

@paulmillr

This comment has been minimized.

Copy link

@paulmillr paulmillr commented Sep 8, 2016

What about webpack tests? Does everything pass on the subsystem?

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 10, 2016

@paulmillr here is the result of running npm test for webpack.

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 10, 2016

@paulmillr here is also the result of running npm test on chokidar

@paulmillr

This comment has been minimized.

Copy link

@paulmillr paulmillr commented Sep 10, 2016

68 failing tests for webpack.

Basically this means Windows subsystem for Linux is broken and shitty. I'll see what we can do here but a more robust solution would be to cease using it until Windows developers would fix all issues.

@eteeselink

This comment has been minimized.

Copy link

@eteeselink eteeselink commented Sep 11, 2016

@paulmillr that's a perfectly valid solution for me, FWIW. WSL is beta so some incompatibilities are to be expected, i guess.

I just discovered it's a known bug in WSL: microsoft/WSL#216. If I were @sokra I'd close this bug until MS fixes inotify.

For people who find this webpack issue, the issue linked above lets you vote on this on UserVoice: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13469097-support-for-filesystem-watchers-like-inotify

@mastrauckas

This comment has been minimized.

Copy link
Author

@mastrauckas mastrauckas commented Sep 11, 2016

I'm going to reply to the bug @eteeselink put a like to.

@bmayen

This comment has been minimized.

Copy link

@bmayen bmayen commented Oct 10, 2016

microsoft/WSL#216 has been closed

@Eccenux

This comment has been minimized.

Copy link

@Eccenux Eccenux commented Oct 15, 2016

I've unistalled Bash on Windows 10 and webpack --watch still isn't working. Even with a very simple config like:

module.exports = {
    entry: './entry.js',
    output: {
        path: __dirname,
        filename: "bundle.js"
    }
};

Path to project is d:\_WWW\!_serwer_root\_test\webpack (if that is important). And entry.js just contains:

console.log('123');
@Eccenux

This comment has been minimized.

Copy link

@Eccenux Eccenux commented Oct 15, 2016

Nevermind... The problem was the ! in the directory name :-/

@bebraw

This comment has been minimized.

Copy link
Member

@bebraw bebraw commented Dec 24, 2016

@lahdo

This comment has been minimized.

Copy link

@lahdo lahdo commented Feb 13, 2017

Try this workaround:

Add this to your webpack configuration file:

    watchOptions: {
        poll: true
    },
@swordman1205

This comment has been minimized.

Copy link

@swordman1205 swordman1205 commented Jul 29, 2017

watchOptions: {
poll: true
}

Thank you. This solution works for me.

@ankitrg

This comment has been minimized.

Copy link

@ankitrg ankitrg commented Aug 11, 2017

I am on webpack 3, and I have poll option enabled, still Webpack picks up first few writes and then doesn't do that. I have tried saving the files via emacs and atom.

@dzwiedziu-nkg

This comment has been minimized.

Copy link

@dzwiedziu-nkg dzwiedziu-nkg commented Oct 27, 2017

I have similar problem on Linux Mint 18.2. After fix inotify issue works fun :)

@toididau456

This comment has been minimized.

Copy link

@toididau456 toididau456 commented Feb 22, 2018

@lahdo thank you!

@vladshlyanin

This comment has been minimized.

Copy link

@vladshlyanin vladshlyanin commented Jul 23, 2018

@lahdo I know, It's a ghost thread, but still - thank you, I've really struggled with this issue!

@hijackthegit

This comment has been minimized.

Copy link

@hijackthegit hijackthegit commented Aug 7, 2018

@lahdo thank you too, saved my day, literally!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.