I want to write a simple react component and package it into a npm package. Other projects can be directly installed through npm and then directly used in jsx through import
. < H2 > current operation: < / H2 >create a new npm package, and then specify the main field in the package.json to the specified js file. The code in the js file is:
if you use babel-loader to jsx syntax in the component package with webpack, the packaged dist will contain the react dependencies in the current project, and when others use it, it will lead to code duplication. How can I directly export jsx the component? if not, how do I need to do it? my requirement now is to develop a react plug-in, but react and webpack are novice! Tears run ~