Webpacker: [4.0.6] using webpack-dev-server in fresh rails app results in Uncaught TypeError

Created on 1 Jun 2019  路  4Comments  路  Source: rails/webpacker

The full error trace is:

decode.js:32 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
    at Module.<anonymous> (decode.js:32)
    at Module../node_modules/querystring-es3/decode.js (decode.js:88)
    at __webpack_require__ (bootstrap:19)
    at Object../node_modules/querystring-es3/index.js (index.js:3)
    at __webpack_require__ (bootstrap:19)
    at Object.<anonymous> (client:6)
    at Object../node_modules/webpack-dev-server/client/index.js?http://localhost:3035 (client:337)
    at __webpack_require__ (bootstrap:19)
    at Object.0 (log.js:47)
    at __webpack_require__ (bootstrap:19)

Steps to reproduce:

  rails new test2 --webpack
  cd test2
  rails g controller pages home
  ./bin/webpack-dev-server
  rails s
  # navigate to localhost:3000/pages/home

There is no error if you just run rails s and rely on webpack compile on demand.

bug webpack

Most helpful comment

...the earlier workaround ( add environment.loaders.delete('nodeModules') to environment.js ) makes webpack-dev-server work again

All 4 comments

...the earlier workaround ( add environment.loaders.delete('nodeModules') to environment.js ) makes webpack-dev-server work again

Please tell me if https://github.com/rails/webpacker/issues/2109#issuecomment-498336919 helps at all.

Was this issue resolved?

@jakeNiemiec yes, resolved. No js error with above steps with latest rails/webpacker.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iChip picture iChip  路  3Comments

amandapouget picture amandapouget  路  3Comments

ankitrg picture ankitrg  路  3Comments

ijdickinson picture ijdickinson  路  3Comments

swrobel picture swrobel  路  3Comments