It seems there are 2 possible main files: index.js (which points to esm) and index.cjs.js. Neither is suited for IE 11. Documentation is lacking in this respect.
As far as I can tell when used for the browser it should be:
/dist/<library-name>/<library-name>.esm.js/dist/<library-name>/<library-name>.jsWhen I create a new project components-lib with starter setting component, and install and build, my dist folder looks like this:
./dist
โโโ [ 224] cjs
โย ย โโโ [ 726] components-lib.cjs.js
โย ย โโโ [ 32970] index-1e5bfcf5.js
โย ย โโโ [ 15] index.cjs.js
โย ย โโโ [ 599] loader.cjs.js
โย ย โโโ [ 635] my-component.cjs.entry.js
โโโ [ 192] collection
โย ย โโโ [ 215] collection-manifest.json
โย ย โโโ [ 96] components
โย ย โย ย โโโ [ 128] my-component
โย ย โย ย โโโ [ 28] my-component.css
โย ย โย ย โโโ [ 1682] my-component.js
โย ย โโโ [ 11] index.js
โย ย โโโ [ 96] utils
โย ย โโโ [ 130] utils.js
โโโ [ 192] components-lib
โย ย โโโ [ 222] components-lib.esm.js <== note there is no file components-lib.js
โย ย โโโ [ 0] index.esm.js <== note this file is completely empty
โย ย โโโ [ 299] p-0bdbdffa.entry.js
โย ย โโโ [ 6031] p-24d0f0ad.js
โโโ [ 128] custom-elements
โย ย โโโ [ 1651] index.d.ts
โย ย โโโ [ 1102] index.js
โโโ [ 256] esm
โย ย โโโ [ 535] components-lib.js
โย ย โโโ [ 32304] index-a5c9c759.js
โย ย โโโ [ 1] index.js
โย ย โโโ [ 517] loader.js
โย ย โโโ [ 566] my-component.entry.js
โย ย โโโ [ 256] polyfills
โย ย โโโ [ 94164] core-js.js
โย ย โโโ [ 10382] css-shim.js
โย ย โโโ [ 19514] dom.js
โย ย โโโ [ 320] es5-html-element.js
โย ย โโโ [ 1136] index.js
โย ย โโโ [ 4383] system.js
โโโ [ 48] index.cjs.js
โโโ [ 31] index.js
โโโ [ 224] types
โโโ [ 96] components
โย ย โโโ [ 96] my-component
โย ย โโโ [ 220] my-component.d.ts
โโโ [ 1510] components.d.ts
โโโ [ 48] index.d.ts
โโโ [ 57854] stencil-public-runtime.d.ts
โโโ [ 96] utils
โโโ [ 85] utils.d.ts
13 directories, 34 files
So using components-lib/components-lib.esm.js for module capable browsers works fine. But the non-module version does not exist.
Having the same question here. With the stencil starter it also comes with this config:
{
type: 'dist',
esmLoaderPath: '../loader',
},
So I tried loading the index.js file in the generated loader folder, still no luck, browser gave me
Uncaught SyntaxError: Unexpected token 'export'
PS. Also tried loading it from dist/collection/components/my-component/my-component.js and browser gave me
Uncaught SyntaxError: Cannot use import statement outside a module
Stencil version: v2.0.3
Tried a build in v1.8.5 and both the my-component.esm.js and my-component.js files are there in the dist/my-component/ folder
Where can I find a Stencil project that works in Internet Explorer 11?
The main problem is that nowhere in the docs we can find any explanation about the dist files.
What are all the p.
The build for old browsers is disabled by default since v2 (https://github.com/ionic-team/stencil/blob/master/CHANGELOG.md#-200-2020-08-31).
here is the documentation to enable it https://stenciljs.com/docs/config-extras
OMG this link is gold.
For dist/ files, you have some informations here https://stenciljs.com/docs/publishing#package-json

This works.
In stencil.config.ts I've set buildEs5: true and the example extras settings.
After the build and firing up a local server in www, index.html loads www/build/project.js and the default "my-component" (so nothing fancy) works in IE 11, Edge 80, Safari 11.
I do suggest that you add this to the documentation, for example under "Guides" could be a topic "Older browsers", and existing page Browser support could link to there.
Most helpful comment
The main problem is that nowhere in the docs we can find any explanation about the dist files.
What are all the p..entry.js files? Which files do we need? It is not well explained in the docs.