-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
p tags get merged and className removed #237
Comments
Having a similar issue, also using next.js. Except all my tags are getting replaced with |
Hi! Is there any code reproducing this issue that I could take a look at? The link is now broken, btw. |
@silvenon It's tricky because there are a lot of tools in the chain here: namely, Next.js, mdx, webpack, babel, and, terser. I think we've narrowed it down to the fact that one of the other libraries ends up with one of its functions mangled to have the name It may take a while for us to create a test case for this, but in the meantime can anyone think of any way that the remark transformation would produce |
Nothing like that comes to mind at the moment, but if you use JSX for tags natively supported by Markdown ( I'm looking forward to that test case once you manage to provide it. |
No test case yet, but I did confirm that disabling mangling in module.exports = {
webpack(config, {dev}) {
// only disable mangling in production
if (dev) {
return config
}
for (const plugin of config.plugins) {
// duck type: is this an UglifyJS plugin?
if (plugin.options && plugin.options.uglifyOptions) {
console.warn('*** disabling mangling in UglifyJS plugin ***')
plugin.options.uglifyOptions.compress = {keep_fnames: true}
plugin.options.uglifyOptions.mangle.keep_fnames = true
}
}
return config
}
} I've attempted to trace the source of whatever is calling our mangled function name in our production bundles, but I haven't figured it out yet. I'm 80% sure that the mangled icon |
That's a pretty wild. It seems so unlikely that the string |
I suspect that this is happening due to JS minification since we haven't been able to reproduce. If you are able to create a repro without code minifying please open an issue and we can keep digging! |
We're using mdx together with next.js' static export.
Everything works perfect, besides one problem.
Certain
![image](https://user-images.githubusercontent.com/1094804/44590729-228a9d80-a7bc-11e8-886e-df37567348fa.png)
p
tags get merged together when the javascript has been run on the static html.The problem is that their className gets lost. As we use
styled-components
(would be the same problem withstyled-jsx
), the styling is broken at that point.An example is this page: https://docs-beta.prisma.io/1.13/understand-prisma/prisma-basics-server-services-data-model-avrp/
At the very bottom, you'll see a paragraph with bad line-height.
If you disable javascript in the browser (in chrome dev tools settings -> preferences -> Debugger -> Disable JavaScript), you can see, that it's rendered correctly without javascript enabled, with an empty
<p></p>
tag before the p tag that will be broken.I saw that mdx is using
remark-squeeze-paragraphs
which as far as I understand should fix exactly this problem. The actualremark-squeeze-paragraphs
just removes not usedp
tags - so this should work.Now the question is, where in the stack does this
p
tag merging happen and how can we fix it?Thanks!
The text was updated successfully, but these errors were encountered: