I am playing with stencil What I have done so far:
- Created a component in stencil
- Published it to the npm
- Created a angular project
- Installed stencil component to the angular project
- Added component.js file to the index.html file
When I am adding
<script src="/node_modules/stencil-poc-ng/dist/mycomponent.js"></script>
then brower console giving the following error:
GET http://localhost:4200/node_modules/stencil-poc-ng/dist/mycomponent.js 404 (Not Found) localhost/:1 Refused to execute script from 'http://localhost:4200/node_modules/stencil-poc-ng/dist/mycomponent.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
You are building an Angular app, it won't be able to access a local path on your computer when running on your browser. What Angular
ng servedoes:Only the "in memory" files are served, then your
http://localhost:4200/node_modules/stencil-poc-ng/dist/mycomponent.jswill always be invalidYou have only two options left:
<script src='https://unpkg.com/[email protected]/dist/mycomponent.js'></script>