Closed ishabo closed 4 years ago
Hi @carloslfu. Thank you very much for this useful library.
I tried to make it work in my react-app/typescript project but I am getting the following error when I build my project with your lib:
./node_modules/xstate-router/lib/index.js Module parse failed: Unexpected token (68:21) You may need an appropriate loader to handle this file type. | exports.getRoutes = getRoutes; | function addRouterEvents(history, configObj, routes) { | const config = { ...configObj }; | if (!config.on) { | config.on = {};
This is due to the "target" set in your tsconfig. I forked your project and changed
"target": "es2018",
to
"target": "es2016",
This causes the JS build to change from
const config = { ...configObj };
const config = Object.assign({}, configObj);
After making this change in my fork, my project builds with your lib without issues.
Please accept my PR if you agree with the change: https://github.com/carloslfu/xstate-router/pull/11/files
Hi @carloslfu. Thank you very much for this useful library.
I tried to make it work in my react-app/typescript project but I am getting the following error when I build my project with your lib:
This is due to the "target" set in your tsconfig. I forked your project and changed
to
This causes the JS build to change from
to
After making this change in my fork, my project builds with your lib without issues.