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

chore(): Make @stencil/core a devDependencies #95

Closed juanmiguelbesada closed 5 months ago

juanmiguelbesada commented 3 years ago

@stencil/core is a dev dependency as it didn't must be installed when installed your package.

PMudra commented 2 years ago

I am very interested in a general explanation of the classification into dependencies and devDependencies.

I guess this was fixed (?) before and discussed in #44 without leaving a hint about the reasoning.

Moving stencil to the devDependencies feels to me like the right thing to do. But Ionic does not do it this way (https://github.com/ionic-team/ionic-framework/blob/1a9be747f22956b05bad7c186c77e82c0fd98556/core/package.json#L34). Is there any specific reason behind that?

marcomontalbano commented 1 year ago

I just did a test about this. I moved @stencil/core into devDependencies section and published the package. Everything is working properly when you load the webcomponents from an index.html:

<script type="module" src="dist/my-project/my-project.esm.js"></script>

but @stencil/core is required when you install the package as a dependency and try to use it:

import 'my-project/dist/components'

@stencil/core is required when you are using the dist-custom-elements as target output. There's a non-documented option called externalRuntime that you can set to false. This will include @stencil/core into the generated bundle so that you'll not need it as dependency.

At this point I think that moving @stencil/core to the peerDependencies (maybe an optional one?) section could be a better approach.