MCPcopy Create free account
hub / github.com/SZzzzz/react-scripts-ts-antd / build

Function build

scripts/build.js:111–150  ·  view source on GitHub ↗
(previousFileSizes)

Source from the content-addressed store, hash-verified

109
110// Create the production build and print the deployment instructions.
111function build(previousFileSizes) {
112 console.log('Creating an optimized production build...');
113
114 let compiler = webpack(config);
115 return new Promise((resolve, reject) => {
116 compiler.run((err, stats) => {
117 if (err) {
118 return reject(err);
119 }
120 const messages = formatWebpackMessages(stats.toJson({}, true));
121 if (messages.errors.length) {
122 // Only keep the first error. Others are often indicative
123 // of the same problem, but confuse the reader with noise.
124 if (messages.errors.length > 1) {
125 messages.errors.length = 1;
126 }
127 return reject(new Error(messages.errors.join('\n\n')));
128 }
129 if (
130 process.env.CI &&
131 (typeof process.env.CI !== 'string' ||
132 process.env.CI.toLowerCase() !== 'false') &&
133 messages.warnings.length
134 ) {
135 console.log(
136 chalk.yellow(
137 '\nTreating warnings as errors because process.env.CI = true.\n' +
138 'Most CI servers set it automatically.\n'
139 )
140 );
141 return reject(new Error(messages.warnings.join('\n\n')));
142 }
143 return resolve({
144 stats,
145 previousFileSizes,
146 warnings: messages.warnings,
147 });
148 });
149 });
150}
151
152function copyPublicFolder() {
153 fs.copySync(paths.appPublic, paths.appBuild, {

Callers 1

build.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected