'How to resolve "Parcel build failed. @parcel/optimizer-terser: "_" is redeclared" error
Good day everyone!
When I tried to build my parcel-based app, I encountered the following error:
Build failed.
@parcel/optimizer-terser: "_" is redeclared
3724 |
> 3725 | let _ = (t1)=>t1
> | ^ "\_" is redeclared
3726 | , t;
3727 | // src/components/visually-hidden/visually-hidden.styles.ts
ℹ It's likely that Terser doesn't support this syntax yet.
Normally, I would have tried to comb through the console logs to try and debug the issues at hand, but I haven't been able to figure out where to start with this one.
Could someone help guide me in that direction please? Thanks mate!
Solution 1:[1]
For me the issue was a wrong import of styled() method when extending a material ui component:
Was importing:
import { styled } from '@mui/material/styles';
instead of:
import styled from 'styled-components';
and was obviously using the styled-components syntax:
const StyledAutocomplete = styled(Autocomplete) <IStyledAutocompleteP>`
// some css here
`;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mihaa123 |
