Closed bugkitio closed 2 years ago
See the --external
flag in the CLI options. By default, anything specified as a dependency will not be inlined into your bundle. Instead, it should be supplied separately.
Depending on what you want to do, you can move Preact into a devDependency or make sure to import Preact as well (add another <script>
tag) alongside your library.
See the
--external
flag in the CLI options. By default, anything specified as a dependency will not be inlined into your bundle. Instead, it should be supplied separately.Depending on what you want to do, you can move Preact into a devDependency or make sure to import Preact as well (add another
<script>
tag) alongside your library.
I totally agree with you opinion, but I also want to know how to force bundle dependencies.
In some cases I need to provide a complete SDK to other developers, they can use CDN to reference my SDK without using any package manager.
Regards
Opinion? As I said, you can move the package into devDependencies
(--external
defaults to dependencies
and peerDependencies
, which is outlined in the docs) in your package.json
or possibly use --external none
if you want no external deps.
Having a dependency doesn't mean a package manager is required -- you just add another script tag (or import) for the dependency in question.
Having a dependency doesn't mean a package manager is required -- you just add another script tag (or import) for the dependency in question.
I know what you mean, i just want to provide multiple ways to use my SDK. User can choose add SDK module to their project, then use package manager or script tag to add SDK dependencies. But i also want the SDK it's out of the box. Just add script tag, not need to care dependencies, bundle my module with all dependencies in one dist js
Oh, I just explain my mean. the solution i know is use devDependencies
Closing this out as it should be answered.
I've simply imported Preact into index.tsx
And then imported the UMD bundle into my HTML file
I get the following console error
Init is definitely working because if I make it return a console.log, it logs out fine
Here's my package.json
Any ideas on why render is undefined? Any library I install with npm results in the same issue
Here's my UMD bundle
Any help would be massively appreciated