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
Implementing D3 as client-side only package #771
Comments
Have you tried to wrap a if condition around it? if (process.BROWSER_BUILD && process.env.NODE_ENV === 'production') {
..
} |
Hey @j-low , were you able to find the solution to above problem. I resolved it by defining a Also, I think we need to also include it as a vendor in Then I used it in |
I followed @piyushchauhan2011 suggestions and it worked. It seems we don't really need to register d3 as a plugin or add anything to nuxt.config.js. As long as we do any dom manipulation from within |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am trying to implement D3 in an app I am building with Nuxt. I have successfully imported it into a view in the
<script>
section withimport * as d3 from 'd3'
however because the app is being rendered server-side D3's functionality doesn't work (i.e.d3.select(...)
). I referred to the Nuxt documentation regarding of client-side only plugins and I attempted to implement the pattern in mynuxt.config.js
file:However D3 throws a
ReferenceError
while looking fordocument
and Nuxt throws aSyntaxError
in the console pointing to something in the plugins field ofnuxt.config.js
. Would someone be able to point to what I'm doing wrong?The text was updated successfully, but these errors were encountered: