Skip to content

Commit

Permalink
fix: clean non-exsit temp file will cause err
Browse files Browse the repository at this point in the history
  • Loading branch information
IOriens committed Nov 17, 2017
1 parent 8dc86bf commit 0751369
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ weweb默认使用我们自己写的编译器对wxml和wxss进行编译,但目
```sh
# 切换成微信开发者工具自带的编译器:使用环境变量 DFT_CMP=true 如下:

# linux
DFT_CMP=true ./bin/weweb demos/demo20170111

# windows
set DFT_CMP=true&&./bin/weweb demos/demo20170111
```

转换成H5后,会存在跨域访问接口及脱离微信环境带来的一些api无法支持的问题。我们可以通过在小程序的`app.json`文件中增加`weweb`配置项来解决一些常见的问题:
Expand Down
9 changes: 7 additions & 2 deletions bin/weweb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function bootWebServer () {
*
*/
function build () {
exec(cmdRm + distPath, function (err, out) {
var execBuild = function (err, out) {
// printLog(out)
err && printLog(err)
util.mkdirsSync(distPath)
Expand Down Expand Up @@ -335,7 +335,12 @@ function build () {
})
}
)
})
}
if (fs.existsSync(distPath)) {
exec(cmdRm + distPath, execBuild)
} else {
execBuild()
}
}

process.on('uncaughtException', function (e) {
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const DIST_PATH = './lib/template/assets/script'
const isProd = process.env.NODE_ENV === 'production'
const showAnalysis = process.env.ANA === 'true'
const watch = process.env.WATCH === 'true'
// 将 css 从文本中提取出来,参数为资源存放的位置
let plugins = [new ExtractTextPlugin('../css/weweb.min.css')]
if (showAnalysis) {
plugins = plugins.concat([new BundleAnalyzerPlugin()])
Expand Down Expand Up @@ -82,6 +83,7 @@ module.exports = {
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
// 注意此处 outputPath 为输出结果的地址
'file-loader?name=[name].[ext]&publicPath=&outputPath=../images/'
// 'image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
Expand Down
Binary file removed 归档.zip
Binary file not shown.

0 comments on commit 0751369

Please sign in to comment.