Skip to content

Commit 73959eb

Browse files
committed
feat: server 启动时i会使用 config.output.local
1 parent 5b9ef89 commit 73959eb

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

lib/models/Config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var Config = function () {
1818
entry: {},
1919
entryGroup: {},
2020
output: {
21+
local: {},
2122
dev: {
2223
path: "./dev",
2324
filename: "[name][ext]"

lib/models/Project.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ var Project = function () {
189189
var output = this.config.getConfig().output;
190190
for (var key in output) {
191191
var op = output[key];
192-
if (!sysPath.isAbsolute(op.path)) {
192+
if (op.path && !sysPath.isAbsolute(op.path)) {
193193
op.path = sysPath.join(this.cwd, op.path);
194194
}
195195
}
@@ -428,10 +428,11 @@ var Project = function () {
428428
key: 'getServerCompiler',
429429
value: function getServerCompiler(handler) {
430430
var config = this.config.getConfig();
431-
config.output = {
431+
config.output = extend(true, {
432432
path: '/cache',
433433
filename: '[name][ext]'
434-
};
434+
}, config.output.local || {});
435+
435436
this.fixCss();
436437

437438
if (handler && typeof handler === 'function') {

src/models/Config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Config {
1010
entry: {},
1111
entryGroup: {},
1212
output: {
13+
local: {},
1314
dev: {
1415
path: "./dev",
1516
filename: "[name][ext]"

src/models/Project.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class Project {
161161
let output = this.config.getConfig().output;
162162
for (let key in output) {
163163
var op = output[key];
164-
if (!sysPath.isAbsolute(op.path)) {
164+
if (op.path && !sysPath.isAbsolute(op.path)) {
165165
op.path = sysPath.join(this.cwd, op.path);
166166
}
167167
}
@@ -395,10 +395,11 @@ class Project {
395395

396396
getServerCompiler(handler) {
397397
let config = this.config.getConfig();
398-
config.output = {
398+
config.output = extend(true, {
399399
path: '/cache',
400400
filename: '[name][ext]'
401-
};
401+
}, config.output.local || {});
402+
402403
this.fixCss();
403404

404405
if (handler && typeof handler === 'function') {

0 commit comments

Comments
 (0)