How does the page call the function packaged by calling webpack

  node.js, question

Suppose the page has an aa () triggered by an automatic call. Write it in < script></script > on the page.

Function aa is written in the entry.js

How should the page call the packed build.js file inside’s functiona

! ! My aafuncaction only triggers on the page! ! ! !

Before, it was called with window Global function, which felt that global pollution was not good.



exports.aa = function(){}


aa()?  ?  ?

There must be an entrance. Otherwise, I don’t know how to find this function.
If you write exports.aa, the aa attribute of this module is your function.
But how can html find this module? . ?

There seems to be no good way to find this entry.js module.

The simpler way to deal with it is

var home = window[''] = window[''] || {}
 home.aa = function(){}

Just don’t crash. .