MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / webpackCompilationCallback

Function webpackCompilationCallback

packages/webpack5/src/bin/index.ts:93–146  ·  view source on GitHub ↗
(
			err: webpack.WebpackError,
			stats: webpack.Stats,
		)

Source from the content-addressed store, hash-verified

91 const compiler = webpack(configuration);
92
93 const webpackCompilationCallback = (
94 err: webpack.WebpackError,
95 stats: webpack.Stats,
96 ) => {
97 if (err) {
98 // Do not keep cache anymore
99 compiler.purgeInputFileSystem();
100
101 console.error(err.stack || err);
102 if (err.details) {
103 console.error(err.details);
104 }
105
106 process.exitCode = 1;
107 return;
108 }
109
110 if (stats) {
111 // Set the process exit code depending on errors
112 process.exitCode = stats.hasErrors() ? 1 : 0;
113
114 if (env.stats) {
115 console.log(
116 stats.toString({
117 chunks: false,
118 colors: true,
119 errorDetails: env.verbose,
120 }),
121 );
122 }
123
124 // if webpack profile is enabled we write the stats to a JSON file
125 if (configuration.profile || env.profile) {
126 console.log(
127 [
128 '',
129 '|',
130 `| The build profile has been written to ${yellow(
131 'webpack.stats.json',
132 )}`,
133 `| You can analyse the stats at ${green(
134 'https://webpack.github.io/analyse/',
135 )}`,
136 '|',
137 '',
138 ].join('\n'),
139 );
140 fs.writeFileSync(
141 path.join(process.cwd(), 'webpack.stats.json'),
142 JSON.stringify(stats.toJson()),
143 );
144 }
145 }
146 };
147
148 if (options.watch) {
149 env.stats && console.log('webpack is watching the files...');

Callers 1

index.tsFile · 0.85

Calls 4

errorMethod · 0.80
joinMethod · 0.80
logMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected