Browse Source

Another ng test (#712)

pull/715/head
Sebastian Stehle 5 years ago
committed by GitHub
parent
commit
0b003ca589
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      frontend/app-config/webpack.config.js
  2. 4
      frontend/package.json

28
frontend/app-config/webpack.config.js

@ -49,7 +49,6 @@ module.exports = function calculateConfig(env) {
const isDevServer = env.WEBPACK_SERVE;
const isTestCoverage = env && env.coverage;
const isTests = env && env.target === 'tests';
const isAot = !isDevServer && !isTests && !isTestCoverage;
const configFile = isTests ? 'tsconfig.spec.json' : 'tsconfig.app.json';
@ -202,6 +201,15 @@ module.exports = function calculateConfig(env) {
{},
),
new plugins.NgToolsWebpack.AngularWebpackPlugin({
tsconfig: configFile,
// Load directly from file system and skip webpack.
directTemplateLoading: true,
// Only run in aot compiler in production.
jitMode: !isProduction,
}),
/*
* Puts each bundle into a file and appends the hash of the file to the path.
*
@ -362,16 +370,6 @@ module.exports = function calculateConfig(env) {
}
}
if (!isTestCoverage) {
config.plugins.push(
new plugins.NgToolsWebpack.AngularWebpackPlugin({
directTemplateLoading: true,
jitMode: !isAot,
tsconfig: configFile,
}),
);
}
if (isProduction) {
config.optimization = {
minimizer: [
@ -408,23 +406,23 @@ module.exports = function calculateConfig(env) {
if (isTestCoverage) {
// Do not instrument tests.
config.module.rules.push({
test: /\.ts$/,
test: /\.[jt]sx?$/,
use: [{
loader: 'ts-loader',
loader: '@ngtools/webpack',
}],
include: [/\.(e2e|spec)\.ts$/],
});
// Use instrument loader for all normal files.
config.module.rules.push({
test: /\.ts$/,
test: /\.[jt]sx?$/,
use: [{
loader: 'istanbul-instrumenter-loader',
options: {
esModules: true,
},
}, {
loader: 'ts-loader',
loader: '@ngtools/webpack',
}],
exclude: [/\.(e2e|spec)\.ts$/],
});

4
frontend/package.json

@ -14,8 +14,8 @@
"build": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config app-config/webpack.config.js --env production",
"build:clean": "rimraf wwwroot/build",
"build:analyze": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config app-config/webpack.config.js --env production --env analyze",
"postinstall": "npx patch-package && ngcc --properties es2015 browser module main --create-ivy-entry-points",
"ngcc": "ngcc --properties es2015 browser module main --create-ivy-entry-points"
"postinstall": "npx patch-package && ngcc",
"ngcc": "ngcc"
},
"dependencies": {
"@angular/animations": "12.0.2",

Loading…
Cancel
Save