Commit 07b69cd3 authored by 邓晓峰's avatar 邓晓峰

fix: webpack bug

parent c2c70e4a
const rm = require('rimraf');
const path = require('path');
const webpack = require('webpack');
const chalk = require('chalk');
const ora = require('ora')
const pkg = require('../../package.json');
const webpackConfig = require('./webpack.prod.babel')
const argv = require('../../server/argv');
const spinner = ora('building for production...')
spinner.start()
rm(argv.releasepath ? path.resolve(argv.releasepath, pkg.name.toLocaleLowerCase()): `./${pkg.name.toLocaleLowerCase()}`, err => {
if (err) throw err
webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
color: true,
progress: true,
modules: false,
children: false,
chunks: true,
chunkModules: true
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
"use strict";
var rm = require('rimraf');
var path = require('path');
var webpack = require('webpack');
var chalk = require('chalk');
var ora = require('ora');
var pkg = require('../../package.json');
var webpackConfig = require('./webpack.prod.babel');
var argv = require('../../server/argv');
var spinner = ora('building for production...');
spinner.start();
rm(argv.releasepath ? path.resolve(argv.releasepath, pkg.name.toLocaleLowerCase()) : "./".concat(pkg.name.toLocaleLowerCase()), function (err) {
if (err) throw err;
webpack(webpackConfig, function (err, stats) {
spinner.stop();
if (err) throw err;
process.stdout.write(stats.toString({
colors: true,
color: true,
progress: true,
modules: false,
children: false,
chunks: true,
chunkModules: true
}) + '\n\n');
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'));
process.exit(1);
}
console.log(chalk.cyan(' Build complete.\n'));
console.log(chalk.yellow(' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n'));
});
});
\ No newline at end of file
......@@ -11332,6 +11332,12 @@
"integrity": "sha512-xc8DUsCLmjvCfoD7LTGE0ou2MIWLx0K9RCZwSHMOdynqRsP4MtUcLeqh1HcQ2dInwDTqn+3CE0/FZh1et+p4jA==",
"dev": true
},
"ctxobj": {
"version": "0.2.1",
"resolved": "https://g.civnet.cn:4873/ctxobj/-/ctxobj-0.2.1.tgz",
"integrity": "sha1-L8lMIa3K6pxS43z6CzxTXVQXcMg=",
"dev": true
},
"currently-unhandled": {
"version": "0.4.1",
"resolved": "https://g.civnet.cn:4873/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
......@@ -14474,6 +14480,12 @@
"nan": "^2.12.1"
}
},
"fsmjs": {
"version": "0.2.1",
"resolved": "https://g.civnet.cn:4873/fsmjs/-/fsmjs-0.2.1.tgz",
"integrity": "sha1-+y1hIJFOxoSsG/AMXwRctA2ZNiI=",
"dev": true
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://g.civnet.cn:4873/function-bind/-/function-bind-1.1.1.tgz",
......@@ -16458,6 +16470,12 @@
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==",
"dev": true
},
"is-interactive": {
"version": "1.0.0",
"resolved": "https://g.civnet.cn:4873/is-interactive/-/is-interactive-1.0.0.tgz",
"integrity": "sha1-zqbmrlyHCnsKAAQHC3tYfgJSkS4=",
"dev": true
},
"is-lower-case": {
"version": "1.1.3",
"resolved": "https://g.civnet.cn:4873/is-lower-case/-/is-lower-case-1.1.3.tgz",
......@@ -19983,6 +20001,12 @@
"integrity": "sha1-UtlXkXa9YPI+ugXEQ4WD80GUS4E=",
"dev": true
},
"node-uuid": {
"version": "1.3.3",
"resolved": "https://g.civnet.cn:4873/node-uuid/-/node-uuid-1.3.3.tgz",
"integrity": "sha1-09tNe1aBDZ5AMjQnZigq8HORcps=",
"dev": true
},
"nopt": {
"version": "3.0.6",
"resolved": "https://g.civnet.cn:4873/nopt/-/nopt-3.0.6.tgz",
......@@ -20403,41 +20427,108 @@
}
},
"ora": {
"version": "3.4.0",
"resolved": "https://g.civnet.cn:4873/ora/-/ora-3.4.0.tgz",
"integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==",
"version": "5.1.0",
"resolved": "https://g.civnet.cn:4873/ora/-/ora-5.1.0.tgz",
"integrity": "sha512-9tXIMPvjZ7hPTbk8DFq1f7Kow/HU/pQYB60JbNq+QnGwcyhWVZaQ4hM9zQDEsPxw/muLpgiHSaumUZxCAmod/w==",
"dev": true,
"requires": {
"chalk": "^2.4.2",
"cli-cursor": "^2.1.0",
"cli-spinners": "^2.0.0",
"log-symbols": "^2.2.0",
"strip-ansi": "^5.2.0",
"chalk": "^4.1.0",
"cli-cursor": "^3.1.0",
"cli-spinners": "^2.4.0",
"is-interactive": "^1.0.0",
"log-symbols": "^4.0.0",
"mute-stream": "0.0.8",
"strip-ansi": "^6.0.0",
"wcwidth": "^1.0.1"
},
"dependencies": {
"ansi-regex": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://g.civnet.cn:4873/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.0",
"resolved": "https://g.civnet.cn:4873/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"resolved": "https://g.civnet.cn:4873/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"cli-cursor": {
"version": "3.1.0",
"resolved": "https://g.civnet.cn:4873/cli-cursor/-/cli-cursor-3.1.0.tgz",
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
"dev": true,
"requires": {
"restore-cursor": "^3.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://g.civnet.cn:4873/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://g.civnet.cn:4873/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"log-symbols": {
"version": "2.2.0",
"resolved": "https://g.civnet.cn:4873/log-symbols/-/log-symbols-2.2.0.tgz",
"integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==",
"has-flag": {
"version": "4.0.0",
"resolved": "https://g.civnet.cn:4873/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
"mimic-fn": {
"version": "2.1.0",
"resolved": "https://g.civnet.cn:4873/mimic-fn/-/mimic-fn-2.1.0.tgz",
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"dev": true
},
"mute-stream": {
"version": "0.0.8",
"resolved": "https://g.civnet.cn:4873/mute-stream/-/mute-stream-0.0.8.tgz",
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
"dev": true
},
"onetime": {
"version": "5.1.2",
"resolved": "https://g.civnet.cn:4873/onetime/-/onetime-5.1.2.tgz",
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
"dev": true,
"requires": {
"chalk": "^2.0.1"
"mimic-fn": "^2.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://g.civnet.cn:4873/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"restore-cursor": {
"version": "3.1.0",
"resolved": "https://g.civnet.cn:4873/restore-cursor/-/restore-cursor-3.1.0.tgz",
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
"onetime": "^5.1.0",
"signal-exit": "^3.0.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://g.civnet.cn:4873/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
......@@ -21033,6 +21124,106 @@
"supports-color": "^2.0.0"
}
},
"log-symbols": {
"version": "2.2.0",
"resolved": "https://g.civnet.cn:4873/log-symbols/-/log-symbols-2.2.0.tgz",
"integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==",
"dev": true,
"requires": {
"chalk": "^2.0.1"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://g.civnet.cn:4873/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://g.civnet.cn:4873/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://g.civnet.cn:4873/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"ora": {
"version": "3.4.0",
"resolved": "https://g.civnet.cn:4873/ora/-/ora-3.4.0.tgz",
"integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==",
"dev": true,
"requires": {
"chalk": "^2.4.2",
"cli-cursor": "^2.1.0",
"cli-spinners": "^2.0.0",
"log-symbols": "^2.2.0",
"strip-ansi": "^5.2.0",
"wcwidth": "^1.0.1"
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://g.civnet.cn:4873/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://g.civnet.cn:4873/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://g.civnet.cn:4873/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://g.civnet.cn:4873/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
}
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://g.civnet.cn:4873/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://g.civnet.cn:4873/strip-ansi/-/strip-ansi-3.0.1.tgz",
......@@ -21105,6 +21296,23 @@
}
}
},
"portscanner": {
"version": "0.1.3",
"resolved": "https://g.civnet.cn:4873/portscanner/-/portscanner-0.1.3.tgz",
"integrity": "sha1-zww4oNEvzXFqEcblmWOrrKavKbE=",
"dev": true,
"requires": {
"async": "0.1.15"
},
"dependencies": {
"async": {
"version": "0.1.15",
"resolved": "https://g.civnet.cn:4873/async/-/async-0.1.15.tgz",
"integrity": "sha1-IYDqyizypspSgNQcBYW+ybPkm9M=",
"dev": true
}
}
},
"posix-character-classes": {
"version": "0.1.1",
"resolved": "https://g.civnet.cn:4873/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
......@@ -25477,6 +25685,27 @@
"chalk": "^2.0.1"
}
},
"spinner": {
"version": "0.3.4",
"resolved": "https://g.civnet.cn:4873/spinner/-/spinner-0.3.4.tgz",
"integrity": "sha1-oMVBO5sKuLZ+PgmU9s7wr6C/bDw=",
"dev": true,
"requires": {
"async": "0.1.x",
"ctxobj": "0.2.x",
"fsmjs": "0.2.x",
"node-uuid": "1.3.3",
"portscanner": "0.1.x"
},
"dependencies": {
"async": {
"version": "0.1.22",
"resolved": "https://g.civnet.cn:4873/async/-/async-0.1.22.tgz",
"integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=",
"dev": true
}
}
},
"split": {
"version": "1.0.1",
"resolved": "https://g.civnet.cn:4873/split/-/split-1.0.1.tgz",
......@@ -23,7 +23,7 @@
"build:clean": "rimraf ./build",
"start": "cross-env NODE_ENV=development node server --port=$port",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
"start:production": "npm run test && npm run build && npm run start:prod",
"start:production": "npm run test && npm run build && npm run start:prod",
"start:prod": "cross-env NODE_ENV=production node server",
"release": "np --no-cleanup --yolo --no-publish",
"cm": "git-cz",
......@@ -203,6 +203,7 @@
"node-plop": "0.18.0",
"null-loader": "0.1.1",
"offline-plugin": "5.0.6",
"ora": "^5.1.0",
"path-to-regexp": "^2.4.0",
"plop": "2.3.0",
"postcss": "7.0.32",
......@@ -229,6 +230,7 @@
"rimraf": "2.6.3",
"shelljs": "0.8.3",
"slash2": "^2.0.0",
"spinner": "^0.3.4",
"style-loader": "^1.2.1",
"stylelint": "10.0.1",
"stylelint-config-recommended": "2.2.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment