score:1
i think this is not a webpack issue, it's app.js file.
in my case, there was a 'let' declaration issue. it was working in a dev environment but wasn't on a production build. basically, in the build process, we need to take special care of const/let/function declarations order and scope, so that after the build, declaration reference will get actual declarations.
my case was:
const products = products.map(group => {
let resultbutton = '';
if (!group.product[0].soldout) {
let price = 0;
price += group.product[0].amount.amount;
if (group.product[0].fees) {
for (let i = 0; i < group.product[0].fees.length; i += 1) {
price += group.product[0].fees[i].amount;
}
}
// here was my wrong declaration
// i corrected by declaring outside of if (!group.product[0].soldout)
// below let resultbutton = '';
// & it works for me after build
let benefits = <li>no benefits defined</li>;
if (
group.product[0].properties&&
group.product[0].properties.length > 0
) {
_.map(group.product[0].properties.property, property => {
if (property.code === 51) {
const benefitsarray = property.content.split('\n');
benefits = benefitsarray.map(item => {
const st = item.replace(/ +/g, '');
return <li key={st}>{item}</li>;
});
}
});
}
resultbutton = (
<div>
<h4>
<ul>{benefits}</ul>
</div>
);
} else {
resultbutton = (
<div>
<soldout>
</div>
);
}
return resultbutton;
});
hope you'll get the answer.
Source: stackoverflow.com
Related Query
- Intégrating React into Symfony (Webpack Encore) : ReferenceError : React is not defined
- Uncaught ReferenceError: React is not defined
- Window is not defined in Next.js React app
- React Uncaught ReferenceError: process is not defined
- React Error: Target Container is not a DOM Element
- window not defined error when using extract-text-webpack-plugin React
- Jquery in React is not defined
- Using jest in my react app, describe is not defined
- error 'document' is not defined : eslint / React
- React JS Error: is not defined react/jsx-no-undef
- React wrapper: React does not recognize the `staticContext` prop on a DOM element
- How to solve Warning: React does not recognize the X prop on a DOM element
- google is not defined in react app using create-react-app
- Why do I have to .bind(this) for methods defined in React component class, but not in regular ES6 class
- Click event not firing when React Component in a Shadow DOM
- 'useState' is not defined no-undef React
- React Uncaught Error: Target container is not a DOM element
- Uncaught ReferenceError: React is not defined
- React Native - __DEV__ is not defined
- Uncaught ReferenceError: regeneratorRuntime is not defined in React
- React Props is Not Defined
- gapi is not defined when loading React Component
- React does not recognize the `computedMatch` prop on a DOM element.
- ReferenceError: React is not defined in jest tests
- React JS Uncaught Reference Error: function not defined
- react function is not defined no-undef
- Uncaught ReferenceError: Buffer is not defined in React
- React component's Material UI theme not scoped locally to Shadow DOM
- fetch method is not defined using ES6 fetch in React
- React context - 'contextType' is not defined
More Query from same tag
- Receive new props in _app.js (nextjs)?
- MobX Mutability vs Immutability
- convert radio buttons into stars
- React: how to test if method is called when updating props?
- ReactJS overriding or editing context along the hierarchy
- Conditional Rendering of Props (no re-render)
- Material-Table with Select (options) fields clears field value on edit mode
- React app only show home page on the server
- Old state is losing while doing search in React
- JSX Bootstrap unterminated
- Error: fields must be passed when initializing state, How so?
- Where in my code should I put my Meteor user methods and allow() permissions?
- Gatsby component shadowing
- useState hook not working on updating map
- You may need an appropriate loader to handle this file type, currently no loaders are configured import Counter from './components/counter.jsx'
- Passing props to child component not working
- Cannot find module 'has-flag'
- Child component not rerendering on change of props
- i'm getting an error of "Firebase Storage: Invalid argument count in `put`: Expected between 1 and 2 arguments, received 0
- webpack tsx Module parse failed: Unexpected token
- TypeError: Cannot read property '_id' of undefined error
- 2 css file with same classname, and the element with that classname have both style
- React, onMouseEnter event trigger all items instead of one hovered?
- Why is this deleting all of my items in the array at once? React
- If the token recieved is valid how can we call the nominate.js component from existing component?
- Conditional property in react/jsx
- Returning 404 not found for the micro frontend dependencies from the host application
- How to fix import/export babel-eslint without configuration file?
- from controlled form into hook
- Typescript - Using Types to constrain parameters