Use webpack to package typescript files into js files, how can configuration solve the scope problem?

currently uses webpack in conjunction with typescript to develop a class library.
but there is a problem. When referencing the method in the packaged js file of ts in the outer html, there will be a problem that this function does not exist. I looked at the reason: there should be a scope problem after webpack packaging. Is there any way to solve this problem?


give an example

import XXX from 'XXX';
window.XXX=XXX;

just write like this


webpack is a module package and cannot reference the js file directly in html.

Menu