Trying to configure HMR through the node.js api as given here https://webpack.github.io/docs/webpack-dev-server.html#hot-module-replacement-with-node-js-api gives an error. HMR through CLI is working fine.
This is the error:
Module parse failed: /u/saxenat/react-blueprint/src/js/app.js Unexpected token (5:16)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:16)
at Parser.pp.raise (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:923:13)
at Parser.pp.unexpected (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:1490:8)
at Parser.pp.parseExprAtom (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:333:12)
at Parser.pp.parseExprSubscripts (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:228:19)
at Parser.pp.parseMaybeUnary (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:207:17)
at Parser.pp.parseExprOps (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:154:19)
at Parser.pp.parseMaybeConditional (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:136:19)
at Parser.pp.parseMaybeAssign (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:112:19)
at Parser.pp.parseExprList (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:660:23)
at Parser.pp.parseSubscripts (/u/saxenat/react-blueprint/node_modules/webpack/node_modules/acorn/dist/acorn.js:252:29)
The app.js file is:
`import React from 'react';
import ReactDOM from 'react-dom';
import Hello from '../components/SayHelloComponent/SayHello.jsx';
ReactDOM.render(
+1
Did you add webpack/hot/dev-server to your entry point (see docs)?
If yes, please show your webpack config file, preferably with unnecessary things stripped out.
I'm closing this issue because of inactivity. Feel free to comment, and we can always re-open it again.
Most helpful comment
Did you add
webpack/hot/dev-serverto your entry point (see docs)?If yes, please show your webpack config file, preferably with unnecessary things stripped out.