Files
dspace-angular/webpack/webpack.aot.js
2018-01-23 15:16:22 +01:00

36 lines
809 B
JavaScript

const {
root
} = require('./helpers');
const {
AngularCompilerPlugin
} = require('@ngtools/webpack');
const tsconfigs = {
client: root('./src/tsconfig.browser.json'),
server: root('./src/tsconfig.server.json')
};
const aotTsconfigs = {
client: root('./src/tsconfig.browser.json'),
server: root('./src/tsconfig.server.aot.json')
};
/**
* Generates a AotPlugin for @ngtools/webpack
*
* @param {string} platform Should either be client or server
* @param {boolean} aot Enables/Disables AoT Compilation
* @returns {AotPlugin} Configuration of AotPlugin
*/
function getAotPlugin(platform, aot) {
return new AngularCompilerPlugin({
tsConfigPath: aot ? aotTsconfigs[platform] : tsconfigs[platform],
skipCodeGeneration: !aot
});
}
module.exports = {
getAotPlugin: getAotPlugin
};