rnicholus / web-components-loader

Webpack loader that makes it incredibly easy to import HTML-centric Web Components into your project.
https://www.npmjs.com/package/web-components-loader
MIT License
36 stars 3 forks source link

Why Append Ref Link to Head? #14

Closed yuens1002 closed 6 years ago

yuens1002 commented 6 years ago

hi there, i noticed in the example, the web-component (WC) ref tag is appended to the body... document.body.appendChild(importEl)

from a number of documentation i've read, WC ref tags are usually in the head tag. So i guess, the question is really why append to document.body?

rnicholus commented 6 years ago

I honestly can't remember why i decided to append this to <body>. Is this causing an issue for you?

yuens1002 commented 6 years ago

thanks for your reply, but i can't seem to use your example code with webpack 4. so i tried to modify the simplest example given from the repo to the following...

module: { rules: [ { test: /.html$/, use: [ // apply multiple loaders and options "web-components-loader", { loader: "web-components-loader" } ] }, ] }

and got the following error

ERROR in ./node_modules/bosonic-core-elements/src/b-accordion.html Module build failed: TypeError: Cannot read property 'output' of undefined at Object.module.exports (/Users/sunny/web-component/node_modules/web-components-loader/lib/index.js:27:6 8) @ ./src/index.js 6:0-85 10:16-28

On Wed, Apr 25, 2018 at 10:19 PM, Ray Nicholus notifications@github.com wrote:

I honestly can't remember why i decided to append this to . Is this causing an issue for you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rnicholus/web-components-loader/issues/14#issuecomment-384491626, or mute the thread https://github.com/notifications/unsubscribe-auth/AGSn-xFA4Zhiq-CpD7wIXmTmmBimyuBlks5tsS7PgaJpZM4TkY_x .

rnicholus commented 6 years ago

I’m not surprised this doesn’t work with recent versions of webpack. I created this as part of an experiment a while back which I’ve since abandoned.

anastasiap commented 6 years ago

It'd be nice if there was some sort of flag saying that it's not working any more. Just to save time for others.