Rewriting an old application and slowly using webpack to wrap pieces as we go. To maintain compatibility with older pieces of the code base there are several functions that are on the global
and need to remain accessible as such for some time. I've tried setting the output
object library
property and this works. However, I end up with my library containing three empty objects (for each entry point). I've looked into the expose-loader
plugin and same result. I'm sure it's a lack of understanding on my part, still trying to work through the learning curve. Taken influence from many SO posts on the matter (https://stackoverflow.com/a/39166592/1893557)
entry: {
app: './app.js',
mystc: './mystc/index.js',
vendor: [
// 'jquery',
'angular',
'angular-aria',
'angular-animate',
'angular-messages',
'angular-sanitize',
'angular-material',
'angular-material-data-table',
'moment',
'bootstrap',
'pikaday',
'timepicker',
'ng-infinite-scroll',
'atrament',
'node-waves',
'cache-autocomplete'
]
},
output: {
// path: __dirname + '/js',
path: __dirname + '/js-webpack',
filename: '[name].bundle.js',
libraryTarget: 'var',
library: ['GlobalAccess', "[name]"]
},
In the image ^^^ you'll see the ouput for this config. What is inside the mystc
entry point is:
require("./loadtesting");
require("./utilities");
require("./webnotifications");
require("./ajaxclient");
require("./Number");
These files point to many functions that have been exported in their respective files. So these functions are used in many pieces of the app and it would be nice to not have to go rename or fix all the functions being called in the code base for now.