ts检查 加大内存参数
This commit is contained in:
parent
8bcc4d7cf0
commit
292895b328
|
|
@ -33,6 +33,7 @@ const oakPathPlugin = require('../babel-plugin/oakPath');
|
|||
|
||||
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
|
||||
const shouldAnalyze = process.env.COMPILE_ANALYZE === 'true';
|
||||
const memoryLimit = process.env.MEMORY_LIMIT ? Number(process.env.MEMORY_LIMIT) : 4096;
|
||||
|
||||
const copyPatterns = [].concat(pkg.copyWebpack || []).map((pattern) =>
|
||||
typeof pattern === 'string'
|
||||
|
|
@ -345,6 +346,7 @@ module.exports = function (webpackEnv) {
|
|||
},
|
||||
mode: 'write-references',
|
||||
// profile: true,
|
||||
memoryLimit,
|
||||
},
|
||||
issue: {
|
||||
// This one is specifically to match during CI tests,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ const oakRpxToPxPlugin = require('../postcss-plugin/oakRpxToPx');
|
|||
|
||||
// Source maps are resource heavy and can cause out of memory issue for large source files.
|
||||
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
|
||||
const memoryLimit = process.env.MEMORY_LIMIT ? Number(process.env.MEMORY_LIMIT) : 4096;
|
||||
|
||||
const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
|
||||
const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
|
||||
|
|
@ -908,7 +909,7 @@ module.exports = function (webpackEnv) {
|
|||
},
|
||||
mode: 'write-references',
|
||||
// profile: true,
|
||||
memoryLimit: 4096,
|
||||
memoryLimit,
|
||||
},
|
||||
issue: {
|
||||
// This one is specifically to match during CI tests,
|
||||
|
|
|
|||
86
lib/build.js
86
lib/build.js
|
|
@ -17,23 +17,33 @@ async function build(cmd) {
|
|||
? `split:${!!cmd.split}`
|
||||
: ''}`)}`);
|
||||
if (cmd.target === 'mp' || cmd.target === 'wechatMp') {
|
||||
const result = cross_spawn_1.default.sync(`cross-env`, [
|
||||
`NODE_ENV=${cmd.mode}`,
|
||||
`NODE_TARGET=${cmd.target}`,
|
||||
`SUB_DIR_NAME=${cmd.subDir || 'wechatMp'}`,
|
||||
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`SPLIT=${!!cmd.split}`,
|
||||
`node`,
|
||||
require.resolve(`../scripts/${cmd.mode === 'production'
|
||||
? 'build-mp.js'
|
||||
: 'start-mp.js'}`),
|
||||
].filter(Boolean), {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
const result = cross_spawn_1.default.sync(
|
||||
`cross-env`,
|
||||
[
|
||||
`NODE_ENV=${cmd.mode}`,
|
||||
`NODE_TARGET=${cmd.target}`,
|
||||
`SUB_DIR_NAME=${cmd.subDir || 'wechatMp'}`,
|
||||
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`SPLIT=${!!cmd.split}`,
|
||||
!!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`,
|
||||
`node`,
|
||||
cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`,
|
||||
require.resolve(
|
||||
`../scripts/${
|
||||
cmd.mode === 'production'
|
||||
? 'build-mp.js'
|
||||
: 'start-mp.js'
|
||||
}`
|
||||
),
|
||||
].filter(Boolean),
|
||||
{
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
if (result.status === 0) {
|
||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`执行完成`)}`);
|
||||
}
|
||||
|
|
@ -42,22 +52,32 @@ async function build(cmd) {
|
|||
}
|
||||
}
|
||||
else if (cmd.target === 'web') {
|
||||
const result = cross_spawn_1.default.sync(`cross-env`, [
|
||||
`NODE_ENV=${cmd.mode}`,
|
||||
`NODE_TARGET=${cmd.target}`,
|
||||
`SUB_DIR_NAME=${cmd.subDir || 'web'}`,
|
||||
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`node`,
|
||||
require.resolve(`../scripts/${cmd.mode === 'production'
|
||||
? 'build-web.js'
|
||||
: 'start-web.js'}`),
|
||||
].filter(Boolean), {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
const result = cross_spawn_1.default.sync(
|
||||
`cross-env`,
|
||||
[
|
||||
`NODE_ENV=${cmd.mode}`,
|
||||
`NODE_TARGET=${cmd.target}`,
|
||||
`SUB_DIR_NAME=${cmd.subDir || 'web'}`,
|
||||
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
!!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`,
|
||||
`node`,
|
||||
cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`,
|
||||
require.resolve(
|
||||
`../scripts/${
|
||||
cmd.mode === 'production'
|
||||
? 'build-web.js'
|
||||
: 'start-web.js'
|
||||
}`
|
||||
),
|
||||
].filter(Boolean),
|
||||
{
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
if (result.status === 0) {
|
||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`执行完成`)}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ export default async function build(cmd: any) {
|
|||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`SPLIT=${!!cmd.split}`,
|
||||
!!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`,
|
||||
`node`,
|
||||
cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`,
|
||||
require.resolve(
|
||||
`../scripts/${
|
||||
cmd.mode === 'production'
|
||||
|
|
@ -76,7 +78,9 @@ export default async function build(cmd: any) {
|
|||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
!!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`,
|
||||
`node`,
|
||||
cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`,
|
||||
require.resolve(
|
||||
`../scripts/${
|
||||
cmd.mode === 'production'
|
||||
|
|
|
|||
Loading…
Reference in New Issue