javascript require doesn't work inside html

后端 未结 2 844
孤独总比滥情好
孤独总比滥情好 2021-01-18 13:05

I\'m writing html code that involves js code. Below a simple example:




Use JavaScript to Cha

2条回答
  •  遇见更好的自我
    2021-01-18 13:45

    Javascript is not the same as node.js

    require() is not a part of JavaScript standard and is not supported by browsers out of the box, it is the node.js module system.

    You might need to directly include the modules; some of the modules might not work in the browser sandbox context.

    Also, tools such as http://browserify.org/ might be useful.

提交回复
热议问题