将某些外部js导入Stenciljs Web组件时出现问题

时间:2018-08-23 14:36:16

标签: web-component stenciljs stencil-component

我已经能够导入一些简单的外部js库(例如矩)到自定义Stencil Web组件而没有任何问题,但是最近我想构建一个依赖于stomp-websocket和sockjs-client的stomp Web组件。

我无法正确导入其中任何一个。无论使用哪种导入方式,我都会在npm start的控制台上收到很多警告,而在浏览器控制台上则得到

TypeError: Cannot read property 'map' of null at my-component.js:13771 "http://localhost:3333/build/mycomponent/my-component.js" @mycomponent.core.js:2193

npm启动控制台:

[52:27.1]  generate styles finished in 974 ms
preferring built-in module 'punycode' over local alternative at 
'(...)/my-component/node_modules/punycode/punycode.js', pass 
'preferBuiltins: false' to disable this behavior or 'preferBuiltins: 
true' to disable this warning
preferring built-in module 'punycode' over local alternative at 
'(...)/my-component/node_modules/punycode/punycode.js', pass 
'preferBuiltins: false' to disable this behavior or 'preferBuiltins: 
true' to disable this warning
preferring built-in module 'string_decoder' over local alternative at 
(...)/my-component/node_modules/string_decoder/lib/string_decoder.js',     
pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
preferring built-in module 'string_decoder' over local alternative at 
'(...)/my-component/node_modules/string_decoder/lib/string_decoder.js', 
pass 'preferBuiltins: false' to disable this behavior or 
'preferBuiltins: true' to disable this warning
[52:29.9]  module map finished in 3.84 s

任何对正在发生的事情的见解都受到赞赏。

0 个答案:

没有答案