next.js: `global` not set in browser from webpack for `2.x-beta`

Example repo showing a reference to MobX which assumes global is window in the browser. https://github.com/philcockfield/nextjs-mobx

To start run:

npm run dev

Error is thrown when MobX attempts to initialize itself by looking at global:

image

The failing line of code: https://github.com/mobxjs/mobx/blob/6e3df706de1f1fc2408ba919559297cd0d07573e/src/core/globalstate.ts#L91

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@arunoda I tested on 2.0.0-beta.5, it works property on my repo right now. Thanks @arunoda

@arunoda, @nkzawa - awesome re #449 - and getting Webpack 2 rolling. That blocking issue seems like it’s progressing, but ominous! Any chance a webpack 2 enabled beta of Nextjs will be released soon?

Yes, it works on 1.2.3.