parent
0bc9e505ae
commit
16bd139017
@ -33,6 +33,7 @@
|
||||
"identity-obj-proxy": "3.0.0",
|
||||
"license-webpack-plugin": "^1.4.0",
|
||||
"rxjs": "6.3.3",
|
||||
"source-map-support": "0.5.11",
|
||||
"ts-loader": "5.3.1",
|
||||
"webpack": "4.29.0",
|
||||
"webpack-dev-server": "3.1.14",
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { getNodeWebpackConfig } from './node.config';
|
||||
import { getSystemPath, normalize } from '@angular-devkit/core';
|
||||
import { BuildNodeBuilderOptions } from '../../node/build/node-build.builder';
|
||||
import { BannerPlugin } from 'webpack';
|
||||
|
||||
describe('getNodePartial', () => {
|
||||
let input: BuildNodeBuilderOptions;
|
||||
@ -84,4 +85,25 @@ describe('getNodePartial', () => {
|
||||
expect(result.externals).not.toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('the sourceMap option when true', () => {
|
||||
it('should add a BannerPlugin', () => {
|
||||
const result = getNodeWebpackConfig({
|
||||
...input,
|
||||
sourceMap: true
|
||||
});
|
||||
|
||||
const bannerPlugin = result.plugins.find(
|
||||
plugin => plugin instanceof BannerPlugin
|
||||
) as BannerPlugin;
|
||||
const options = (<any>bannerPlugin).options;
|
||||
|
||||
expect(bannerPlugin).toBeTruthy();
|
||||
expect(options.banner).toEqual(
|
||||
'require("source-map-support").install();'
|
||||
);
|
||||
expect(options.raw).toEqual(true);
|
||||
expect(options.entryOnly).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Configuration } from 'webpack';
|
||||
import { Configuration, BannerPlugin } from 'webpack';
|
||||
import * as mergeWebpack from 'webpack-merge';
|
||||
import * as nodeExternals from 'webpack-node-externals';
|
||||
|
||||
@ -35,6 +35,16 @@ function getNodePartial(options: BuildNodeBuilderOptions) {
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
if (options.sourceMap) {
|
||||
webpackConfig.plugins = [
|
||||
new BannerPlugin({
|
||||
banner: 'require("source-map-support").install();',
|
||||
raw: true,
|
||||
entryOnly: false
|
||||
})
|
||||
];
|
||||
}
|
||||
return webpackConfig;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user