Javascript webcomponents-lite.js中出现错误
尝试运行应用程序时在控制台中收到此错误代码Javascript webcomponents-lite.js中出现错误,javascript,webpack,web-component,Javascript,Webpack,Web Component,尝试运行应用程序时在控制台中收到此错误代码 webcomponents-lite.js:64Uncaught TypeError: Cannot read property 'getAttribute' of null at webcomponents-lite.js:64 at Object.549 (webcomponents-lite.js:74) at __webpack_require__ (bootstrap a218042…:52) at Objec
webcomponents-lite.js:64Uncaught TypeError: Cannot read property 'getAttribute' of null
at webcomponents-lite.js:64
at Object.549 (webcomponents-lite.js:74)
at __webpack_require__ (bootstrap a218042…:52)
at Object.1242 (webcomponents.bundle.js:8)
at __webpack_require__ (bootstrap a218042…:52)
at webpackJsonpCallback (bootstrap a218042…:23)
at webcomponents.bundle.js:2
以下是我如何使用webpack实例化脚本:
entry: {
'polyfills': './src/polyfills.browser.ts',
'vendor': './src/vendor.browser.ts',
'main': './src/main.browser.ts',
'webcomponents': './bower_components/webcomponentsjs/webcomponents-lite.js',
},
使用webpack条目对象时出现此错误,但如果改用:
<script src="/webcomponentsjs/webcomponents-lite.js"></script>
在我的index.html页面上,它可以正常工作,没有错误
有没有人有这方面的经验
编辑:::
我的同事和我有相同版本的bower_组件和node_组件,删除并重新安装了所有组件。他的作品和我的作品都没有。我们注意到,当我们查看bower_组件文件时,我们有不同的文件和文件夹(不知道如何)。将他们项目中的bower_组件文件发送给我后,我用他们的bower文件替换了我的bower_组件文件,它成功了……您似乎没有使用正确版本的
webcomponents lite.js
。正如@Bobort所暗示的,当前分支不工作。删除已安装的版本,然后安装
您也可以使用bower获得它:
> bower i -S webcomponentsjs
可能您在标签中导入的版本与在网页包中使用的版本不同。您似乎没有使用正确版本的
webcomponents lite.js
。正如@Bobort所暗示的,当前分支不工作。删除已安装的版本,然后安装
您也可以使用bower获得它:
> bower i -S webcomponentsjs
也许你在标签中导入的版本与你在网页包中使用的版本不一样。我们在这里没有太多的内容来解决这个问题……你能不能把代码贴在你遇到这个问题的地方。根据git repo,它的构建无论如何都失败了,截至目前:更新了条目示例,你还想看其他作品吗?@Bobort当我使用脚本标签时,它会工作,所以我不认为它是一个坏的构建。对于我们来说,在解决问题方面没有太多需要继续的地方…你能不能把代码发布到你遇到这个问题的地方。根据git repo,它的构建无论如何都会失败,截至目前:使用entry example更新,您还想看到其他部分吗?@Bobort当我使用脚本标记时,它会工作,所以我认为它不是一个坏的构建。