score:0
Accepted answer
the require
keyword is used for commonjs modules, but it looks like you've configured node.js to run your application using ecmascript modules. the equivalent way to bring in routes
using ecmascript modules is something like:
import { routes } from './routes.js';
bear in mind that you will have to write your routes.js
file to be ecmascript modules compatible also, something like:
const routes = [
...
];
export { routes };
Source: stackoverflow.com
Related Query
- ReferenceError: require is not defined (on my rest api)
- webpack : Uncaught ReferenceError: require is not defined
- require is not defined
- ReactJS: Uncaught ReferenceError: require is not defined
- React - Uncaught ReferenceError: require is not defined
- Using gulp-babel gives Uncaught ReferenceError: require is not defined
- require is not defined after using plugin-transform-runtime
- Uncaught ReferenceError: regeneratorRuntime is not defined in react 17, webpack 5 while making api calls through actions
- ReferenceError : Dispatch is not defined
- ReferenceError navigator is not defined for FingerprintJS
- ReactJS Uncaught ReferenceError function is not defined
- require not defined error on bundled JS reactjs
- fetch api call data is not defined
- ReactJS with Webpack: Uncaught ReferenceError: require is not defined
- require is not defined in a Electron-React-Webpack-Typescript app with ipcRenderer.on
- Reactjs require not defined
- Uncaught ReferenceError: require is not defined at Object.url Electron-React-Typescrypt
- Push object from JSON rest api into empty array not working in React
- Webpack ReferenceError: require is not defined (ReactJS)
- Require is not defined using webpack and yarn
- Rest API is not working in Reactjs
- React-Bootstrap Uncaught ReferenceError: require is not defined
- ReactJs - Multiple Components - Error: Uncaught ReferenceError: require is not defined
- ReferenceError: require is not defined when importing ApolloClient from 'apollo-boost'
- Intégrating React into Symfony (Webpack Encore) : ReferenceError : React is not defined
- React js with jsx: Uncaught ReferenceError: require is not defined
- Can not do cross domain REST API Call from localhost
- Require is not defined using ReactJs with babel and webpack
- Getting ReferenceError: require is not defined when passing contextIsolation: true with preload script
- Encountering error ReferenceError: regeneratorRuntime is not defined for Expressjs API on netlify
More Query from same tag
- ReactJs function trough parents then child with FunctionalComponent
- App.jsx:43 Uncaught (in promise) TypeError: this.state.concerts.map is not a function(…)
- Using @apollo/react-hooks, the react app crashes hard on refresh being expired
- Redux: Execute two actions after one another
- JWT decoding working in React Native but not for React
- Disable RootStateOrAny in React typescript?
- Enzyme `mount` not rendering `Route` elements
- Modify SVG with Styled-components (react / next)
- React: Link to a div on another html page
- How to mock $.ajax call in JEST
- Cannot assign RefObject<HTMLDivElement> to RefObject<HTMLElement> instance
- How to based in a condition apply or not a property into a jsx element
- React - update object in state
- Why react won't set the state after Redux action trigger?
- Handling Multiple Checkboxes ReactJS?
- Next.js trouble with document.getElementById
- writing clean code: find an property in object-array with null-check
- React JSX conditional rendering of column layout
- Can I disable the Material-UI SpeedDial mouseover event
- How to remove strings from a json file
- How can I have active nav link in React with React Router Dom but just on big screens until my breakpoints kick in?
- Testing React components with Enzyme when component uses events
- Testing handle change function in React using Enzyme and Jest
- Why useEffect in Redux state is causing infinite loop:
- trying to display JSON with 422 error Rails React
- React Typescript how send props and use it in child component
- reactjs get select values - always undefined
- Why am I unable to rollback my migrations?
- I get a contextTypes error when I try to test a very simple component
- reactjs OR condition breaks in the second comparison