Production build fails but dev works fine
See original GitHub issueI’ve spotted production build fail with error
Uncaught ReferenceError: y is not defined
(See screenshot below)
Steps to reproduce - create fresh react app with TypeScript.
Add dependencies
npm install react-mapbox-gl mapbox-gl --save
Try to build with
npm run build
And after check with
npm serve -s build
Code from my new App
import React from 'react';
import ReactMapboxGl, {Feature, Layer} from "react-mapbox-gl";
import logo from './logo.svg';
import './App.css';
const mapToken = "your_token_here";
const MapBox = ReactMapboxGl({accessToken: mapToken})
const polygonPaint = {
'fill-color': '#6F788A',
'fill-opacity': 1
};
const AllShapesPolygonCoords = [
[
[-0.13235092163085938, 51.518250335096376],
[-0.1174163818359375, 51.52433860667918],
[-0.10591506958007812, 51.51974577545329],
[-0.10831832885742188, 51.51429786349477],
[-0.12531280517578122, 51.51429786349477],
[-0.13200759887695312, 51.517823057404094]
]
];
const Map: React.FC = ({children}) => {
const mapParams = {
style: "mapbox://styles/mapbox/light-v8",
containerStyle: {height: "60vh", width: "100%"}
}
return (
<MapBox {...mapParams}>
<>
{children}
</>
</MapBox>
);
};
function App() {
return (
<div className="App">
<Map>
<Layer type="fill" paint={polygonPaint} />
<Feature coordinates={AllShapesPolygonCoords}/>
</Map>
</div>
);
}
export default App;
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9
Top Results From Across the Web
Next.js production fails but dev works - Stack Overflow
The reason why it's doing that in prod and not dev is because nextjs will only check types on a production build (as...
Read more >Troubleshooting build errors and crashes - Expo Documentation
This particular error means that the app is importing ./src/Routes and it is not found. The cause could be that the filename case...
Read more >ng serve fails but ng build works : r/angular - Reddit
But if I try to use ng serve the "compile" fails with ~20… ... is weird since A. the thing is a module...
Read more >Troubleshooting Node.js Deploys - Heroku Dev Center
Check the buildpack · Compare Node and npm Versions · Make sure the lockfile is up to date · Don't check in generated...
Read more >Deployment | Create React App
npm run build creates a build directory with a production build of ... It also works well when integrated into an existing server...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@naseemkhan7021 that didn’t work for me. I wonder why. I’m on React by the way.
@naseemkhan7021 very thanks!!! work for me