fkrauthan
05/01/2018, 5:00 PMjohnogle
05/04/2018, 11:24 PMfkrauthan
05/04/2018, 11:29 PMjohnogle
05/04/2018, 11:33 PMNAPIVersion and NModuleScope. That plus a updating the webpack config so that it knows that all of the N/* modules are externally available over amdjohnogle
05/04/2018, 11:34 PM{externals: {"N/record": {amd: "N/record"}}}johnogle
05/04/2018, 11:34 PMjohnogle
05/04/2018, 11:35 PM@hitc/netsuite-types npm module with TypeScript so this snippet does it for me:johnogle
05/04/2018, 11:35 PMconst externals = {};
fs.readdirSync(path.resolve(context, "node_modules/@hitc/netsuite-types/N")).forEach(function (file) {
if (file === '.' || file === '..') return;
const module = 'N/' + file.replace('.d.ts', '');
externals[module] = {amd: module};
});fkrauthan
05/04/2018, 11:38 PMplugins: [
new WrapperPlugin({
header: function (fileName, externalDependencies) {
return `
/**
* @preserve
*
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define([${Object.keys(externalDependencies).map(d => `"${d}"`).join(",")}], function(${Object.values(externalDependencies).join(",")}) {
${NETSUITE_GLOBAL_SHIMS.map(shim => `
if (typeof(${shim}) === "undefined") {
${shim} = {};
}
`).join('')}
`;
},
footer: function () {
return `
return {
pageInit: NetSuiteSSP.pageInit,
};
});
`
}
})
]fkrauthan
05/04/2018, 11:39 PMoutput: {
filename: '[name].bundle.js',
library: 'NetSuiteSSP',
path: path.resolve(__dirname, 'dist')
}fkrauthan
05/04/2018, 11:40 PMWrapperPlugin a bit to give me a list of external dependencies and define externals like you did for all netsuite dependenciesjohnogle
05/04/2018, 11:41 PMfkrauthan
05/04/2018, 11:42 PMfkrauthan
05/04/2018, 11:43 PMjohnogle
05/05/2018, 1:47 AM