Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json unpkg behavior #2172

Open
kamilzielinskidev opened this issue Jan 30, 2020 · 0 comments
Open

package.json unpkg behavior #2172

kamilzielinskidev opened this issue Jan 30, 2020 · 0 comments
Labels

Comments

@kamilzielinskidev
Copy link

Stencil version:

 @stencil/core@latest

I'm submitting a:

[ ] bug report
[x] 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:
I am not sure why it works this way, but unpkg property in package.json in out of the box solution for component (didn't check ootb for app) serves the component .js file. And this file is requested by .html, by docs by linking to the specific dist/file.js:

Put a script tag similar to this
<script src='https://unpkg.com/my-name@0.0.1/dist/myname.js'></script>
in the head of your index.html

Expected behavior:
In .html I would like to link without the dist/file.js

<script src='https://unpkg.com/my-name@0.0.1'></script>

as it makes more sense while using the packacke.json unpkg property

Related code:
This is caused by the code in ootb dist/my-component/my-component.js and its url construct.

  var parts = scriptElm.src.split('/');
  parts.pop();
  parts.push('my-component');
  var url = parts.join('/');

  var scriptElm = doc.createElement('script');
  scriptElm.setAttribute('type', 'module');
  scriptElm.src = url + '/my-componentjs';
@ionitron-bot ionitron-bot bot added the triage label Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant