react-bulma-components icon indicating copy to clipboard operation
react-bulma-components copied to clipboard

[HELP] compile for browser only

Open wiryonolau opened this issue 2 years ago • 4 comments

Hi possible to compile for browser only ( es5 or umd ) , for non nodejs project

wiryonolau avatar Sep 06 '22 13:09 wiryonolau

Can you explain a little what you mean? Like being able to add the scripts directly on your html?

couds avatar Nov 10 '22 09:11 couds

yeah to be able to be call using without webpack, like react.js itself we can call in html directly.

wiryonolau avatar Nov 10 '22 12:11 wiryonolau

Can you provide a code example on how are you using react component with that setup? Thanks

couds avatar Nov 16 '22 08:11 couds

In react if you use browser only ( non nodejs ) you just import in the header directly

<html>
<head>
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script type="text/javascript" src="/index.js"></script>
</head>
<body>
<div id="root" ></div>
</body>
</html>

index.js

ReactDOM.createRoot(document.getElementById("root")).render(<h1>Hello World</h1>);

Perhaps you can include the final min.js or js in dist folder

wiryonolau avatar Dec 29 '22 09:12 wiryonolau