Reputation: 3
When I am importing code from a js file and displaying it as <div>{String(code)}</div>
on a webpage where code
is imported as import code from "./code.js
.
The problem is gatsby develop
showing the code on the page as I wrote code in code.js
but gatsby build
then gatsby serve
showing weird code written in one line not exactly same as written in code.js
.
I don't know why is this happening? Any suggestions?
Upvotes: 0
Views: 747
Reputation: 1028
That happens because gatsby build
, by default, uses uglify
to compress your code in order to make it slimmer for a production environment.
Try running gatsby build --no-uglify
Upvotes: 2