Ask questionsunclear / difficult to import uuidv4
(!) Unresolved dependencies https://rollupjs.org/guide/en#warning-treating-module-as-external-dependency crypto (imported by node_modules/uuid/lib/rng.js, commonjs-external-crypto) (!) Missing global variable name Use output.globals to specify browser global variable names corresponding to external modules crypto (guessing 'crypto')
How can we clarify how to make svelte handle this dependency?
No luck with results on google. Potential opportunity: improve docs re: dependencies
Answer
questions
EmilTholin
Hi @bionicles!
uuid/v4 uses a Node build by default that doesn't work in the browser. You can set the browser option of the rollup-plugin-node-resolve plugin to true in order for Rollup to look for the browser field in dependencies' package.json instead and use that build if it exists.
resolve({
browser: true
})
Related questions