-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi, I am experiencing this error when I use the package.
Compiled with problems:
×
ERROR
Cannot find module './chaos-react.cjs.development.js'
at webpackMissingModule (http://localhost:3000/static/js/bundle.js:7050:69)
at ./node_modules/react-chaos/dist/index.js (http://localhost:3000/static/js/bundle.js:7050:176)
at options.factory (http://localhost:3000/static/js/bundle.js:41417:31)
at __webpack_require__ (http://localhost:3000/static/js/bundle.js:40840:33)
at fn (http://localhost:3000/static/js/bundle.js:41074:21)
at ./src/App.js (http://localhost:3000/static/js/bundle.js:17:69)
at options.factory (http://localhost:3000/static/js/bundle.js:41417:31)
at __webpack_require__ (http://localhost:3000/static/js/bundle.js:40840:33)
at fn (http://localhost:3000/static/js/bundle.js:41074:21)
at ./src/index.js (http://localhost:3000/static/js/bundle.js:119:62)
ERROR in ./node_modules/react-chaos/dist/index.js 6:2-62
Module not found: Error: Can't resolve './chaos-react.cjs.development.js' in '/home/xxxxx/chaos-demo/node_modules/react-chaos/dist'
What I tried
- Deleting
package-lock.jsonand runningnpm install - Verified that the module 'react-chaos' is installed in my project by running
npm list react-chaos
my code
import React from 'react';
import withChaos from 'react-chaos';
// Define a component
const ComponentToWrap = () => {
// Simulate an error
if (Math.random() < 0.5) {
throw new Error('Oops! Something went wrong.');
}
return <p>I may have chaos.</p>;
};
// Wrap the component with Chaos
const ComponentWithChaos = withChaos(ComponentToWrap, 8, 'Custom error message: Chaos level 8');
// Create a component with Chaos level 8 and a custom error message
const App = () => {
return (
<div>
<h1>React Chaos Demo</h1>
<ComponentWithChaos />
</div>
);
};
export default App;Metadata
Metadata
Assignees
Labels
No labels