Skip to content

Commit

Permalink
release: [email protected] (#55)
Browse files Browse the repository at this point in the history
* chore: version

* feat: support --disabled-mock (#56)

* feat: adjust 2 disabledMock

* fix: add option --disabled-mock

* fix: adjust log position

* fix: error mimetype of images (#57)

fix: error mimetype of images

* chore: changelog
  • Loading branch information
ClarkXia authored Aug 28, 2019
1 parent 3a31445 commit cffa95f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2.1.11

- [fix] error mimetype of image
- [feat] support --disable-mock to disable mock server

## 2.1.10

- [fix] refactor mock dev server alibaba/ice#2455 alibaba/ice#2471 alibaba/ice#2462
Expand Down
1 change: 1 addition & 0 deletions packages/ice-scripts/bin/child-process-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ program
.option('--analyzer', '开启构建分析')
.option('--analyzer-port', '设置分析端口号')
.option('--disabled-reload', '关闭 hot reload')
.option('--disabled-mock', '关闭 mock')
.option('--config <config>', 'use custom config')
.parse(process.argv);

Expand Down
20 changes: 11 additions & 9 deletions packages/ice-scripts/lib/commands/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,20 @@ module.exports = async function(context, subprocess) {

let isFirstCompile = true;

// devMock 在 devServer 之前启动
const originalDevServeBefore = webpackConfig.devServer.before;
webpackConfig.devServer.before = function(app, server) {
if (process.env.MOCK !== 'none') {
if (commandArgs.disabledMock) {
log.warn('关闭了 mock 功能');
} else {
// devMock 在 devServer 之前启动
const originalDevServeBefore = webpackConfig.devServer.before;
webpackConfig.devServer.before = function(app, server) {
// dev mock
webpackDevMock(app);
}

if (typeof originalDevServeBefore === 'function') {
originalDevServeBefore(app, server);
}
};
if (typeof originalDevServeBefore === 'function') {
originalDevServeBefore(app, server);
}
};
}

const compiler = webpack(webpackConfig);
const devServer = new WebpackDevServer(compiler, webpackConfig.devServer);
Expand Down
3 changes: 2 additions & 1 deletion packages/ice-scripts/lib/config/setWebpackLoaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ module.exports = (chainConfig, mode = 'development') => {

rule.use(type)
.loader(URL_LOADER)
.options(Object.assign(defaultAssetsLoaderOpts, loaderOpts));
// keep defaultAssetsLoaderOpts immutable
.options(Object.assign({}, defaultAssetsLoaderOpts, loaderOpts));
}

// css loader
Expand Down
2 changes: 1 addition & 1 deletion packages/ice-scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ice-scripts",
"version": "2.1.10",
"version": "2.1.11",
"description": "ICE SDK",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit cffa95f

Please sign in to comment.