score:0
I've had a similar issue in the past, if it is in fact the same problem here's how to solve it.
The require you have shown is within the wrapping IIFE, which means that this
is not window
but the function, meaning that when you try to find require
it's not in scope. In order to fix this you need use imports-loader.
In your case, under module
and then loaders
, add:
{
test: require.resolve("/*require/import path which requires the file where require("url") is*/"),
use: "imports-loader?this=>window"
}
Hope this solves your problem.
score:0
You need to use something like browserify or babelify.
See a more in-depth explanation here.
Source: stackoverflow.com
Related Query
- `require is not defined` error when using electron with a react app
- Uncaught ReferenceError: process is not defined error when converting react (TS) app to PWA with webpack and babel config
- window not defined error when using extract-text-webpack-plugin React
- React app showing page with "404 the requested path could not be found" when using Apache
- When Using Redux Saga with React Get This Error .. Uncaught TypeError: getPosts is not a function
- 404 Not Found error in preflight OPTIONS when executing a PUT method in CakePHP API with axios in React App
- 'dispatch' is not defined when using useReducer with useContext in react
- "Uncaught ReferenceError: require is not defined" when importing into App.js for React App created using CDN links
- "Uncaught TypeError: fs.writeFile is not a function" when using Electron with React
- not assignable to type '() => void' error when using React useMemo() with TypeScript?
- Getting an error "A non-serializable value was detected in the state" when using redux toolkit - but NOT with normal redux
- google is not defined in react app using create-react-app
- Create React App not showing error message with ErrorBoundary
- 'window is not defined' error when using style-loader with webpack
- Typescript does not error on compilation with create react app
- Perf is not defined - running react app with webpack-dev-server
- Why do my styled component keyframes error with ts-styled-plugin(9999) in react when using percentage instead of TO/FROM
- JS error when executing electron app with native module on other computer
- Property does not exist on React component when defined with recompose
- URLSearchParams is not defined error when running tests with jest
- 403 error code when using axios.post to Django endpoint in React app
- Unicode characters not showed when bundling and deploying React app with webpack and babel
- How to fix dependency error with React App using Jest
- ERROR ReferenceError: React is not defined | Using React Components in Angular
- Using emmet with a react app in vs code is not working
- Electron app not working with React-Router using browserHistory
- Should not have to disable eslint when using with react
- 'render' is not defined when running create react app
- AWS creds error when making calls from local react app "Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1"
- React App Not Rendering When Using JS in HTML
More Query from same tag
- Components not re-rendering on route change - React HashRouter
- Flux React gulp
- How can I store an object in MeteorJS/React in a variable to return later?
- Prototype Pollution - npm vulnerability can't be fixed?
- React Class passing stale props to Child stateless component
- React and Flux: "dispatch in the middle of a dispatch" to show error message from an API call
- React native: invoke method dynamically
- How change value of checkbox checked using useState in React
- Date dropdown field selection
- Props not getting passed to onClick function
- How Do you reset the CSS in React if you're doing styled components?
- How to BLINK a <DIV> according to database data (json)
- How to define an instantiated React component in a Typescript interface?
- React Route render different banner image for each route
- How to use redux-persist with custom middleware
- Othello Minimax Algorithm Doesn't Work In React.js
- How to get out a search result from forEach in an Object?
- SASS template strings. Is it a way to use them?
- react-query - getQueryData and setQueryData with pagination
- Why is it showing DELETE /api/product/productId 404
- React - How to call a function which is inside another callback function
- How to load single css file in webpack instead of multiple files from node_modules
- React refresh redirects to home with same url of the where page refreshed
- My custom modal doesn't close because of react's useState hook
- Handle multiple input value change within an object
- console.log(Wrapper.debug()) showing <ContextConsumer> [function] </ContextConsumer>
- How do I fix my "No valid exports main found" compile error?
- Update table without refreshing after adding an item in reactjs
- TypeError: data.map is not a function in JavaScript
- Select DOM element by text from React component