merge
This commit is contained in:
commit
224f60d385
|
|
@ -17,7 +17,7 @@ let moduleFileExtensions = [
|
|||
'mp.ts',
|
||||
'ts',
|
||||
];
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (process.env.NODE_ENV !== 'production' && process.env.PROD !== 'true') {
|
||||
moduleFileExtensions = [
|
||||
'dev.mp.js',
|
||||
'dev.mp.ts',
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ let moduleFileExtensions = [
|
|||
'pc.jsx',
|
||||
'jsx',
|
||||
];
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (process.env.NODE_ENV !== 'production' && process.env.PROD !== 'true') {
|
||||
moduleFileExtensions = [
|
||||
'dev.web.js',
|
||||
'dev.web.ts',
|
||||
|
|
@ -49,16 +49,15 @@ if (process.env.NODE_ENV !== 'production') {
|
|||
'dev.ts',
|
||||
'dev.tsx',
|
||||
].concat(moduleFileExtensions);
|
||||
}
|
||||
else {
|
||||
moduleFileExtensions = [
|
||||
'prod.web.js',
|
||||
'prod.web.ts',
|
||||
'prod.web.tsx',
|
||||
'prod.js',
|
||||
'prod.ts',
|
||||
'prod.tsx',
|
||||
].concat(moduleFileExtensions);
|
||||
} else {
|
||||
moduleFileExtensions = [
|
||||
'prod.web.js',
|
||||
'prod.web.ts',
|
||||
'prod.web.tsx',
|
||||
'prod.js',
|
||||
'prod.ts',
|
||||
'prod.tsx',
|
||||
].concat(moduleFileExtensions);
|
||||
}
|
||||
|
||||
// Resolve file paths in the same order as webpack
|
||||
|
|
|
|||
|
|
@ -11,15 +11,16 @@ async function build(cmd) {
|
|||
//ts类型检查 waring 还是error,
|
||||
//主要web受影响,error级别的话 控制台和网页都报错,warning级别的话 控制台报错
|
||||
const TSC_COMPILE_ON_ERROR = cmd.check !== 'error';
|
||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`build ${cmd.target} environment: ${cmd.mode}`)}`);
|
||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`build ${cmd.target} environment: ${cmd.mode} prod: ${!!cmd.prod}`)}`);
|
||||
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}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`node`,
|
||||
require.resolve(`../scripts/${cmd.mode === 'production'
|
||||
? 'build-mp.js'
|
||||
|
|
@ -41,8 +42,9 @@ async function build(cmd) {
|
|||
`NODE_TARGET=${cmd.target}`,
|
||||
`SUB_DIR_NAME=${cmd.subDir || 'web'}`,
|
||||
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
|
||||
`COMPILE_ANALYZE=${cmd.analyze}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`node`,
|
||||
require.resolve(`../scripts/${cmd.mode === 'production'
|
||||
? 'build-web.js'
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ commander_1.default
|
|||
.command('start')
|
||||
.option('--sourceMap', 'sourceMap')
|
||||
.option('--analyze', 'analyze')
|
||||
.option('--prod', 'prod')
|
||||
.option('--memoryLimit <memoryLimit>', 'memoryLimit of node')
|
||||
.option('-t, --target <target>', 'target')
|
||||
.option('-m, --mode <mode>', 'mode')
|
||||
|
|
|
|||
|
|
@ -33,9 +33,11 @@ function packageJsonContent({ name, version, description, cliVersion, cliName, c
|
|||
"scripts": {
|
||||
"make:domain": "${cliBinName} make",
|
||||
"start:mp": "${cliBinName} start --target mp --mode development",
|
||||
"start:mp:prod": "${cliBinName} start --target mp --mode development --prod",
|
||||
"build:mp": "${cliBinName} build --target mp --mode production",
|
||||
"build-analyze:mp": "${cliBinName} build --target mp --mode production --analyze",
|
||||
"start:web": "${cliBinName} start --target web --mode development",
|
||||
"start:web:prod": "${cliBinName} start --target web --mode development --prod",
|
||||
"build:web": "${cliBinName} build --target web --mode production",
|
||||
"build-analyze:web": "${cliBinName} build --target web --mode production --analyze",
|
||||
"build-sourcemap-analyze:web": "${cliBinName} build --target web --mode production --sourcemap --analyze",
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ const env = getClientEnvironment();
|
|||
|
||||
fs.emptyDirSync(paths.appBuild);
|
||||
|
||||
//copy
|
||||
const { copyLocaleFiles } = require('./locales/copy-mp-locales');
|
||||
copyLocaleFiles();
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) {
|
||||
console.log(chalk.red(err.stack || err));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default async function build(cmd: any) {
|
|||
//ts类型检查 waring 还是error,
|
||||
//主要web受影响,error级别的话 控制台和网页都报错,warning级别的话 控制台报错
|
||||
const TSC_COMPILE_ON_ERROR = cmd.check !== 'error';
|
||||
Success(`${success(`build ${cmd.target} environment: ${cmd.mode}`)}`);
|
||||
Success(`${success(`build ${cmd.target} environment: ${cmd.mode} prod: ${!!cmd.prod}`)}`);
|
||||
if (cmd.target === 'mp' || cmd.target === 'wechatMp') {
|
||||
const result = spawn.sync(
|
||||
`cross-env`,
|
||||
|
|
@ -30,8 +30,9 @@ export default async function build(cmd: any) {
|
|||
`NODE_TARGET=${cmd.target}`,
|
||||
`SUB_DIR_NAME=${cmd.subDir || 'wechatMp'}`,
|
||||
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
|
||||
`COMPILE_ANALYZE=${cmd.analyze}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`node`,
|
||||
require.resolve(
|
||||
`../scripts/${
|
||||
|
|
@ -59,8 +60,9 @@ export default async function build(cmd: any) {
|
|||
`NODE_TARGET=${cmd.target}`,
|
||||
`SUB_DIR_NAME=${cmd.subDir || 'web'}`,
|
||||
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
|
||||
`COMPILE_ANALYZE=${cmd.analyze}`,
|
||||
`COMPILE_ANALYZE=${!!cmd.analyze}`,
|
||||
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
|
||||
`PROD=${!!cmd.prod}`,
|
||||
`node`,
|
||||
require.resolve(
|
||||
`../scripts/${
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ program
|
|||
.command('start')
|
||||
.option('--sourceMap', 'sourceMap')
|
||||
.option('--analyze', 'analyze')
|
||||
.option('--prod', 'prod')
|
||||
.option('--memoryLimit <memoryLimit>', 'memoryLimit of node')
|
||||
.option('-t, --target <target>', 'target')
|
||||
.option('-m, --mode <mode>', 'mode')
|
||||
|
|
|
|||
|
|
@ -40,9 +40,11 @@ export function packageJsonContent({
|
|||
"scripts": {
|
||||
"make:domain": "${cliBinName} make",
|
||||
"start:mp": "${cliBinName} start --target mp --mode development",
|
||||
"start:mp:prod": "${cliBinName} start --target mp --mode development --prod",
|
||||
"build:mp": "${cliBinName} build --target mp --mode production",
|
||||
"build-analyze:mp": "${cliBinName} build --target mp --mode production --analyze",
|
||||
"start:web": "${cliBinName} start --target web --mode development",
|
||||
"start:web:prod": "${cliBinName} start --target web --mode development --prod",
|
||||
"build:web": "${cliBinName} build --target web --mode production",
|
||||
"build-analyze:web": "${cliBinName} build --target web --mode production --analyze",
|
||||
"build-sourcemap-analyze:web": "${cliBinName} build --target web --mode production --sourcemap --analyze",
|
||||
|
|
|
|||
Loading…
Reference in New Issue