ionic-team / stencil-component-starter

Minimal starter project for building shareable web components with Stencil
https://github.com/ionic-team/stencil
MIT License
278 stars 128 forks source link

Build script does not create files for unpkg #91

Closed scarhand closed 3 years ago

scarhand commented 3 years ago

Stencil version:

@stencil/core@2.3.0 

I'm submitting a:

[x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior: When building a project the entry file for unpkg is not created as advertised.

The generated README mentions that the component can be included through unpkg with the following script tag <script src='https://unpkg.com/my-component@0.0.1/dist/mycomponent.js'></script>. That file is not generated by the build script (assuming the name is updated to reflect the project/component name). I'm not entirely sure if the hyphen is missing on purpose in the file name (mycomponent.js).

In package.json the entry for unpkg is defined as "unpkg": "dist/my-component/my-component.js". That file is also not generated by the build script.

Expected behavior:

The stencil build script should create the file(s) necessary for unpkg.

Steps to reproduce:

Related code: Example project can be found here: Git: https://github.com/scarhand/scarhand-stencil-test Unpkg: https://unpkg.com/browse/scarhand-stencil-test@0.0.1/

AlexSapoznikov commented 3 years ago

I am currently having the exact same problem!

claviska commented 3 years ago

Looks like the file extension changed from .js to .esm.js. Manually updating it in your package.json should resolve it until this gets fixed.

AlexSapoznikov commented 3 years ago

@claviska Currently dist/esm/index.js file is empty - is this correct behaviour though?

claviska commented 3 years ago

I'm not sure why the empty index is generated. The correct file uses <namespace>.js, not index.