dsuryd / dotNetify-react-template

Real-time React SPA template using dotNetify.
https://dotnetify.net/react
Apache License 2.0
203 stars 57 forks source link

HelloWorld is not defined #2

Closed jjwilliams42 closed 7 years ago

jjwilliams42 commented 7 years ago

When following the steps for the VS 2017 + WebPack instructions, afterwards the screen is white and I get an uncaught exception error:

Uncaught ReferenceError: HelloWorld is not defined
    at Object.<anonymous> (bundle.js:73)
    at t (bundle.js:1)
    at bundle.js:1
    at bundle.js:1

Output from Webpack:

Asset    Size  Chunks                    Chunk Names
./wwwroot/bundle.js  578 kB       0  [emitted]  [big]  main
   [7] ./~/react-dom/lib/ReactDOMComponentTree.js 6.27 kB {0} [built]
  [13] ./~/react-dom/lib/ReactInstrumentation.js 601 bytes {0} [built]
  [34] ./~/react/lib/React.js 5.11 kB {0} [built]
  [96] ./~/react/react.js 55 bytes {0} [built]
 [158] ./~/react-dom/index.js 58 bytes {0} [built]
 [159] ./src/HelloWorld.jsx 2.74 kB {0} [built]
 [161] ./~/dotnetify/dist/dotnetify-react.js 24.7 kB {0} [built]
 [268] ./~/react-dom/lib/ReactDOM.js 5.19 kB {0} [built]
 [324] ./~/react-dom/lib/renderSubtreeIntoContainer.js 422 bytes {0} [built]
 [327] ./~/react/lib/ReactChildren.js 6.19 kB {0} [built]
 [328] ./~/react/lib/ReactDOMFactories.js 5.48 kB {0} [built]
 [330] ./~/react/lib/ReactPropTypes.js 500 bytes {0} [built]
 [332] ./~/react/lib/ReactVersion.js 350 bytes {0} [built]
 [334] ./~/react/lib/createClass.js 688 bytes {0} [built]
 [340] ./src/app.js 497 bytes {0} [built]
    + 326 hidden modules

Any ideas why this may be happening?

jjwilliams42 commented 7 years ago

Digging further I see the definition of HelloWorld in bundle.js:

var HelloWorld = function (_React$Component) {...}

dsuryd commented 7 years ago

I re-ran the steps, it still works. The output of webpack is mostly the same except the size of your bundle.js is 578kb, while mine 1.88mb. Is there anything that's different between the HelloWorld in this github to yours?

dsuryd commented 7 years ago

Also, maybe adding this to the html header will fix the webpack bundle issue: <meta http-equiv="content-type" content="text/html; charset=UTF8">

jjwilliams42 commented 7 years ago

Apparently I just needed to clean my project, ha!