This issue has me stumped and I've read countless posts on ways to resolve it to no avail.
I created a reusable npm react package from a larger production react application. Thus, the package is a subset of the larger application. The reusable package will be used in other react applications - including the original production application. The production application works without issue.
After I created the package - which works without issues - I created a test application and installed my package in it. The test application was created with create-react-app. I modified index.js to import my package and specified the name of my package in ReactDOM.render. The test application runs and renders my package without issue.
Everything looks good.
Next, I went back to the original react application to replace the subset of code I used to create my package. I installed my package, and replaced the original code with the name of my package.
Since the test application works, I naively expected the production application to also work with my package.
However, I'm getting the following error when I start the application:
./node_modules/@myorganization/mypackage/ContextLib/CoreConsumer/dataRequest.js 11:11
Module parse failed: Unexpected token (11:11)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| };
| export class ClDataRequestObject extends ClDataCore {
> _request = {};
| _cancelToken;
Note the error occurs in my package code.
The error seems to point to _request = {} but when I remove that line and re-run the application, the same error occurs on _cancelToken.
Nothing I've tried from the posts I've read works and I'm unsure I even understand the error.
Does an incompatibility exist somewhere in a node_modules package with the application and my package?
Any help, guidance or insight will be gratefully appreciated.
Please help me learn.
Thank you.