'React Component Library using Webpack

Hello is it possible to make a react component library using script tag and npm in the same code base

example I have a next js app then I will import the component in script tag

    <script
         type="module"
         src="https://cdn.jsdelivr.net/gh/@me/bundle.js"
      ></script>

and also I can import the component using

import Mycomponent from '@me/librayname'

Is this possible currently I implement it using different code base/repository which is confusing im using tsdx for npm library and webpack for scriptag. If anyone can guide me here is much appreciated. Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source