Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

貌似页面多了,热编译就很卡了。 #5

Closed
bluekevin opened this issue Apr 23, 2018 · 11 comments
Closed

貌似页面多了,热编译就很卡了。 #5

bluekevin opened this issue Apr 23, 2018 · 11 comments

Comments

@bluekevin
Copy link

页面才20几个,修改页面和JS之后。开发模式hot就很卡,如何处理呢

@weijhfly
Copy link

我的也是,20个页面左右,修改后要8秒左右才能编译完成,如果有解决办法求告知

@givebest
Copy link
Owner

@bluekevin @weijhfly 不介意的话把你们项目发我一份看看

@weijhfly
Copy link

没有怎么用过webpack,但听说7、8秒是很快的,是不是不需要解决了

@givebest
Copy link
Owner

@weijhfly 好吧,应该是有优化的空间

@weijhfly
Copy link

@givebest 这个问题确实普遍存在,可以看这里的讨论jantimon/html-webpack-plugin#724,只要页面一多起来,html-webpack-plugin就处理得很慢,我试过html-webpack-plugin1.7.0版本,几十个页面编译时间只有3秒左右,但似乎不支持art-template,html-webpack-plugin插件似乎也没有官方的解决办法,不知您可否看看有没有可靠的解决办法呢

@givebest
Copy link
Owner

@weijhfly

"devDependencies": {
    "art-template-loader": "^1.4.3",
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.25.0",
    "babel-loader": "^7.0.0",
    "babel-preset-env": "^1.5.2",
    "better-npm-run": "^0.0.15",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "^5.0.1",
    "css-loader": "^0.28.4",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^0.11.2",
    "glob": "^7.1.2",
    "happypack": "^4.0.1",
    "html-webpack-plugin": "^2.30.1",
    "image-webpack-loader": "^3.3.1",
    "jquery": "^1.12.4",
    "less": "^2.7.2",
    "less-loader": "^4.0.4",
    "postcss-loader": "^2.0.5",
    "style-loader": "^0.18.2",
    "url-loader": "^0.5.9",
    "webpack": "^3.12.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.11.2"
  },
  "dependencies": {
    "art-template": "^4.12.1"
  }

我试着把一些插件升级了一下,没有出现兼容问题,开发环境把 minChunks 改大一些效果更佳 :)

@weijhfly
Copy link

一般中等的项目会有50左右页面,大一点的100左右,不知道效率有没有提升,最好是在10秒内编译完成吧,有时间我试试

@weijhfly
Copy link

非常感谢,问题已解决

@jlcool
Copy link

jlcool commented Oct 12, 2018

@weijhfly 你咋解决的

@givebest
Copy link
Owner

@bluekevin @jlcool @weijhfly 这个问题可以确定是图片压缩的锅,可暂时注释掉图片压缩来解决。后面我会更新 webpack.config 文件开发环境不再压缩图片。

@givebest
Copy link
Owner

@bluekevin @jlcool @weijhfly 已更新为开发时不压缩图片,本地项目测试已大大提升热更新效率 5d4371b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants