Skip to content
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

Adding NPM dependencies appears to break client scripts in production #18

Open
sohara opened this issue Mar 18, 2021 · 3 comments
Open

Comments

@sohara
Copy link

sohara commented Mar 18, 2021

Hi there,

I have run into an issue where it appears that importing anything from an npm package in a client script breaks the client script (it doesn't run on the page) in production. It works fine in development.

I have a repro case here: master...sohara:test-npm-dependencies
(console logging works if you comment out the import)

Any ideas on why this is not working?

@amannn
Copy link
Owner

amannn commented Mar 22, 2021

Hi @sohara and thanks for the report,

hmm, no – that's the first time I hear this. Isn't this what I'm doing here as well?

import initWidgets from 'next-client-script/dist/initWidgets';

Would you be interested in looking into this and potentially providing a fix?

@sohara
Copy link
Author

sohara commented Mar 23, 2021

@amannn Yes, I suppose it is similar to that example (an npm dependency). However using other npm dependencies doesn't seem to work. I wasn't able to fix this issue and decided to use a parallel rollup build instead, with the bundles written to /public.

@amannn
Copy link
Owner

amannn commented Mar 23, 2021

Hmm, interesting. Thanks for the report though. I'm currently not affected by this issue, so I'll leave it open for now in case someone else wants to look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants