-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🗺 v2 sourcemaps not working (totally NOT styled-components related) #6278
Comments
I have styled components working here, but I'm not using the gatsby plugin. I'm wondering, do you also have the package
|
Yes it's added, i mean styled-components work, sourcemaps dont Edit: Not 💅 related, purely Gatsby v2 related, 😄 |
Since the styled-components plugin doesn't change any webpack config i think this is an issue with gatsby v2 purely I fixed it as follows:
exports.onCreateWebpackConfig = ({ stage, actions }) => {
if (stage === 'develop') {
actions.setWebpackConfig({
devtool: 'cheap-module-source-map'
});
}
}; That way the sourcemaps are properly loaded: I went with |
So now I think this could become a bug hunt for v2 towards why aren't sourcemaps properly loading to begin with??? 🤔 |
But major props to the fact that as users we can tweak and fix those inner configs ourselves! Top reason I choose Gatsby! |
Any thoughts @giraffesyo 😮 ? |
@shelldandy Nope sorry, I haven't used sourcemaps yet. I misunderstood the original question to be about styled-components :( |
I thought initially that was related but later on discovered its not. I've updated the title and original description to be more fit @giraffesyo |
Do sourcemaps not work for any parts of Gatsby v2? Or is this a styled-components specific issue? |
Any parts of Gatsby v2, you can open it up on Chrome Developer tool and for example this non-styled-components non-react just vanillaJS code looks like that: When it should look like this: (It looks like that after I apply the fix on What I can see is that Gatbsy by default sets the gatsby/packages/gatsby/src/utils/webpack.config.js Lines 253 to 266 in a9bc9b8
However for some reason So it might be just a plugin order situation on the final webpack config happening behind the scenes (?) That's all the insights I got so far @giraffesyo @KyleAMathews |
This was a problem back in v1 and @KyleAMathews fixed it here: f5191a0 However, it looks like the same issue is back on v2:
|
…evelop mode for easier debugging (gatsbyjs#10083) Closes gatsbyjs#6278 Sourcemaps are not currently working on gatsby v2. This fixes that on 1 string.
Steps to reproduce
Start a new Gatsby project on v2
Expected result
Sourcemaps show original file names/code to debug (at least in development)
Actual result
Sourcemaps shown already compiled code 🤔
Environment
The text was updated successfully, but these errors were encountered: