Anyone knows how can we generate CDN script for an...
# random
e
Anyone knows how can we generate CDN script for any javascript or react application? Instead of adding JS or react code on website I want to inject my code via CDN. Any idea how can I generate this CDN sscript for my application which I will add on my website.
r
you can't really inject your code via cdn right? i assume you want to make a library/component on react, and allow clients to mount is wherever on their site, if that's the case, you can check this article which uses create-react-library to publish a module on npm.
d
I guess you want to cdnify assets? Webpack and its plugins would be the way to go
e
Thanks guys let me check
e
are you looking for some service like www.jsdelivr.com or host the entire app like via netlify or similar?
e
@echoing-judge-67264 @damp-coat-97256 @rough-piano-8900 I have created an application and published on npmjs and I am using CDN script tag to add it on website landing page but I want my application to behave differently based on different website. How can I do that any idea? I am just adding script tag on website is there any way to implement such usecase if yes can anyone sugggest what can I do? CDN url :
<script src="<https://unpkg.com/my-npm-package@1.0.4/index.js>"></script>
in short I want my CDN script tag to work only on specific websites only how can I do that?
can we pass data directly from CDN script tag so that it is accessible inside package? I have script tag like this
<script src="<https://unpkg.com/my-npm-package@1.0.5/index.js>"></script>
if I pass data-* attributes then can I access them in my package index.js file if not then how to pass data from script CDN tag which I can access inside package index.js file?