Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSR] Issue with webpack and token function since v3 #217

Open
amangeot opened this issue Dec 5, 2018 · 4 comments
Open

[SSR] Issue with webpack and token function since v3 #217

amangeot opened this issue Dec 5, 2018 · 4 comments

Comments

@amangeot
Copy link

amangeot commented Dec 5, 2018

Hello,
I upgraded from v2 to v3 and it went well when building my code with webpack until I did it with server-side rendering.

My SSR build compiles successfully and throws the error below when running.
v2 had no issues but I would really like to use v3 with its network errors dispatching failure errors instead request errors.

Do you guys have any suggestion for where to look at?

P.S. I have async/await code running successfully all over my code
redux-api-middleware v3.0.1
node v6.11.2

C:\Users\Adrien\Documents\Dev\front-end-ssr\node_modules\redux-api-middleware\lib\index.cjs.js:315
async function getJSON(res) {
^^^^^^^^

SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\Adrien\Documents\Dev\front-end-ssr\dist\server\webpack:\external "redux-api-middleware":1:1)
at webpack_require (C:\Users\Adrien\Documents\Dev\front-end-ssr\dist\server\webpack:\webpack\bootstrap df994b170392f2cd3d7f:19:1)
at Object. (C:\Users\Adrien\Documents\Dev\front-end-ssr\dist\server\serverRenderer.js:38632:79)
at webpack_require (C:\Users\Adrien\Documents\Dev\front-end-ssr\dist\server\webpack:\webpack\bootstrap df994b170392f2cd3d7f:19:1)
at Object. (C:\Users\Adrien\Documents\Dev\front-end-ssr\dist\server\serverRenderer.js:38362:87)
at webpack_require (C:\Users\Adrien\Documents\Dev\front-end-ssr\dist\server\webpack:\webpack\bootstrap df994b170392f2cd3d7f:19:1)
at C:\Users\Adrien\Documents\Dev\front-end-ssr\dist\server\webpack:\webpack\bootstrap df994b170392f2cd3d7f:62:1

@darthrellimnad
Copy link
Contributor

I don't think async was supported for Node versions before 7.6? (https://node.green/#ES2017-features-async-functions)

You could try to update your server version of node and see if this resolves the issue. Otherwise, you may need to additionally compile the redux-api-middleware code in order to convert the async statements in code, before running on the server.

Hope this helps :)

@lhtdesignde
Copy link

Just ran into the same issue. running node 6.4. Did it solve the issue with the node update?

@amangeot
Copy link
Author

Hello @lhtdesignde , we haven't updated yet. Have you tried?

@lhtdesignde
Copy link

Just updated node to 8.16.1 and I don't get this error anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants