我无法使用我创建的 npm 组件包。我已经成功发布了该包,但是当我在新代码中使用它时,它显示此错误“SyntaxError: /home/trinndra/Desktop/react-test/node_modules/iconbox1/index.js: Support for the Experimental syntax 'jsx ' 当前未启用 (6:17)"
我的包名:“iconbox1”
我的 npm 包代码在这里:
import React,{Component} from "react"
class Welcome extends Component{
render(){
return (
<input type="text" placeholder="Your name"></input>
)
}
}
module.exports.Welcome = Welcome;
我在我的主应用程序中使用它:
import logo from './logo.svg';
import './App.css';
import {Welcome} from "iconbox1"
function App() {
return (
<div className="App">
<Welcome></Welcome>
</div>
);
}
export default App;