Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
webpackConfig.plugins.unshift(
new DefinePlugin({
'ROOT_DIR': JSON.stringify(srcPath)
})
);
// Adjust the loader src path.
webpackConfig.module.rules[webpackConfig.module.rules.length - 1].include = srcPath;
// This is needed exclusively for internal runtime unit tests,
// which is why it's here instead of alias-builder or the shared test.webpack.config.js
// It's relative from src/app/
webpackConfig.resolve.alias['@blackbaud/skyux-builder/runtime'] = runtimePath;
// Instead of adding skyux2 as a dependency of skyux-builder
webpackConfig.resolve.alias['@skyux/theme/css/sky.css'] =
'../../utils/runtime-test-skyux.css';
// Remove sky-style-loader
delete config.preprocessors['../../utils/spec-styles.js'];
config.files.pop();
config.set({
webpack: webpackConfig,
coverageReporter: {
dir: path.join(process.cwd(), 'coverage', 'src-app')
}
});
}
buildAliasList: function (skyPagesConfig, argv) {
let alias = {
'sky-pages-spa/src': spaPath('src'),
'sky-pages-internal/runtime': outPath('runtime')
};
// Order here is very important; the more specific CSS alias must go before
// the more generic dist one.
if (skyPagesConfig.skyux.cssPath) {
alias['@skyux/theme/css/sky.css'] = spaPath(skyPagesConfig.skyux.cssPath);
}
if (skyPagesConfig.skyux.importPath) {
alias['@blackbaud/skyux/dist'] = spaPath(skyPagesConfig.skyux.importPath);
}
// Allow SPAs to provide custom module aliases.
const moduleAliases = skyPagesConfig.skyux.moduleAliases;
if (moduleAliases) {
const command = (argv && argv.command) ? argv.command : 'serve';
Object.keys(moduleAliases).forEach((key) => {
if (command === 'serve') {
alias[key] = spaPath(moduleAliases[key]);
} else {
alias[key] = skyPagesConfigUtil.spaPathTemp(moduleAliases[key]);
expect(
alias['@blackbaud/skyux/dist']
).toBe(path.join(process.cwd(), importPath));
config = lib.getWebpackConfig({
runtime: runtimeUtils.getDefaultRuntime(),
skyux: {
mode: 'advanced',
cssPath: cssPath
}
});
alias = config.resolve.alias;
expect(
alias['@skyux/theme/css/sky.css']
).toBe(path.join(process.cwd(), cssPath));
});
beforeAll(function (done) {
styleLoader.loadStyles().then(done);
});
}());