gajus / isomorphic-webpack

Abstracts universal consumption of application code base using webpack.
Other
291 stars 17 forks source link

Demo no longer works after upgrading to v2.0.0 or greater #13

Closed gz2432 closed 7 years ago

gz2432 commented 7 years ago

It seems ISOMORPHIC_WEBPACK is no longer present when executing under Node? Getting ReferenceError: document is not defined... after upgrading to the latest version. Works prior to v2.0.0.

gajus commented 7 years ago

@georgezhu01 Please try in a clean environment, i.e.

rm -fr ./isomorphic-webpack-demo
git clone git@github.com:gajus/isomorphic-webpack-demo.git
cd ./isomorphic-webpack-demo
npm install
export DEBUG=express:application,isomorphic-webpack
npm start
gajus commented 7 years ago

I have just tried and it is working fine with the above instructions. Therefore, I am assuming this is due to a cache somewhere in your setup.

If I am wrong, please follow up and I will re-open the issue.

gz2432 commented 7 years ago

@gajus, thanks for looking into this. I am still seeing an issue with v2.0.2. After a fresh clone of the repo, I updated package.json to "isomorphic-webpack": "^2.0.2" then proceeded with the instructions you listed and got a different error then what I reported originally:

SyntaxError: /Users/georgezhu/dev/isomorphic-webpack-demo/src/app/style.css: Unexpected token (1:0)
> 1 | .greetings {
  | ^
2 |  font-weight: bold;
3 | }
4 |
   at Parser.pp$5.raise (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:4333:13)
   at Parser.pp.unexpected (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:1705:8)
   at Parser.pp$3.parseExprAtom (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:3670:12)
   at Parser.parseExprAtom (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:6591:22)
   at Parser.pp$3.parseExprSubscripts (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:3414:19)
   at Parser.pp$3.parseMaybeUnary (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:3394:19)
   at Parser.pp$3.parseExprOps (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:3324:19)
   at Parser.pp$3.parseMaybeConditional (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:3301:19)
   at Parser.pp$3.parseMaybeAssign (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:3264:19)
   at Parser.parseMaybeAssign (/Users/georgezhu/dev/isomorphic-webpack-demo/node_modules/babylon/lib/index.js:5813:20)

With the same steps using v1.9.1 or 1.6.0 there are no issues.

gajus commented 7 years ago

I apologies – looks like I forgot to commit part of migration to v2.

The demo has been fixed.