I have the following script in a web application:
I have several external js files containing several amd modules (they were created by typescript, but I don't want to use ts-loader, for now). each of these files contains more than one amd module, for example:
define("Namespace/Module1", ["require", "exports"], function (require, exports) { .... } define("Namespace/Module2", ["require", "exports"], function (require, exports) { .... }
In my main application, I request modules exported by these files using
var a = require("Namespace/Module1").
I have used SystemJ so far and using the correct configuration everything works, but I would like to start using webpack for bundling, and I donβt know how to add these files depending on the requirements.
I tried adding them to the script tags after importing requireJS, but (of course), the webpack loader uses its own "required" loader, and it does not work.
Using externals in the webpack configuration makes webpack aware that they are not modules, but global, so it excludes require ("aaa") from the generated package and expects a global aaa variable
function(module, exports) { module.exports = aaa; }
How can I tell webpack that when it generates my package, it should still use require ("Namespace / Module") , but first, calling all the " define " in my external files?
I hope that my explanation is enough, and if I do something wrong, if I follow bad practices or something else, explain.
Thank you in advance