mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
refactor: use helper to resolve report path
This commit is contained in:
@ -10,11 +10,11 @@ import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||||
import TerserPlugin from 'terser-webpack-plugin';
|
import TerserPlugin from 'terser-webpack-plugin';
|
||||||
|
|
||||||
import { getProjectFilePath, getProjectRootPath } from '../helpers/project';
|
|
||||||
import { PlatformSuffixPlugin } from '../plugins/PlatformSuffixPlugin';
|
import { PlatformSuffixPlugin } from '../plugins/PlatformSuffixPlugin';
|
||||||
import { applyFileReplacements } from '../helpers/fileReplacements';
|
import { applyFileReplacements } from '../helpers/fileReplacements';
|
||||||
import { addCopyRule, applyCopyRules } from '../helpers/copyRules';
|
import { addCopyRule, applyCopyRules } from '../helpers/copyRules';
|
||||||
import { WatchStatePlugin } from '../plugins/WatchStatePlugin';
|
import { WatchStatePlugin } from '../plugins/WatchStatePlugin';
|
||||||
|
import { getProjectFilePath } from '../helpers/project';
|
||||||
import { hasDependency } from '../helpers/dependencies';
|
import { hasDependency } from '../helpers/dependencies';
|
||||||
import { applyDotEnvPlugin } from '../helpers/dotEnv';
|
import { applyDotEnvPlugin } from '../helpers/dotEnv';
|
||||||
import { env as _env, IWebpackEnv } from '../index';
|
import { env as _env, IWebpackEnv } from '../index';
|
||||||
@ -374,14 +374,13 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
|||||||
});
|
});
|
||||||
|
|
||||||
config.when(env.report, (config) => {
|
config.when(env.report, (config) => {
|
||||||
const projectRoot = getProjectRootPath();
|
|
||||||
config.plugin('BundleAnalyzerPlugin').use(BundleAnalyzerPlugin, [
|
config.plugin('BundleAnalyzerPlugin').use(BundleAnalyzerPlugin, [
|
||||||
{
|
{
|
||||||
analyzerMode: 'static',
|
analyzerMode: 'static',
|
||||||
generateStatsFile: true,
|
generateStatsFile: true,
|
||||||
openAnalyzer: false,
|
openAnalyzer: false,
|
||||||
reportFilename: resolve(projectRoot, 'report', 'report.html'),
|
reportFilename: getProjectFilePath('report/report.html'),
|
||||||
statsFilename: resolve(projectRoot, 'report', 'stats.json'),
|
statsFilename: getProjectFilePath('report/stats.json'),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user