> On 4. Sep 2024, at 21:52, Richard Eckart de Castilho <r...@apache.org> wrote:
> 
> optimally the code should be available on some JavaScript CDN from where 
> people could easily incorporate it.
> 
> Since annotator is on npm, it should be usable through https://unpkg.com/.

Looks like we only publish the "raw" ES6 modules to npm which are meant not 
directly
suitable for consumption in a browser. I believe typically, there would be some 
"dist"
folder as well that would contain a bundled version of the module.

I'm not familiar with the whole lerna/tsc/webpack stack that is used in 
annotator.

Using single-module-per-repo esbuild setup, I would have a build.mjs file that 
I call
from `npm run build` which would go something like this:

```
esbuild.build({
  entryPoints: ['index.ts'],
  outfile: `dist/annotator.min.js`,
  globalName: 'annotator',
  bundle: true,
  sourcemap: true,
  minify: true,
  target: 'es2018',
  loader: { '.ts': 'ts' },
  logLevel: 'info',
  plugins: [sassPlugin()]
})
```

That would produce a JS file that could be published to npmjs/unpkg for 
consumption by
in a browser.

Any idea how to achieve that with the mono-repo setup used by annotator and 
with the
stack used here? 

-- Richard

Reply via email to