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

how compile front-end code ? #1770

Closed
legend91325 opened this issue May 28, 2020 · 5 comments
Closed

how compile front-end code ? #1770

legend91325 opened this issue May 28, 2020 · 5 comments

Comments

@legend91325
Copy link

I am an backend development, I already run success backend code 。 but I don`t how to compile fornt code. Do anyone have some experience about it ?

我是一名后端工程师,后端代码已经成功运行了,请问前端如何编译打包部署呢? 我现在把webapp代码单独拿出来,放在代码库里了。 后续考虑前后端开发分开。 但是我对前端经验很少,编译一直各种失败。 请问有谁有成功编译前端代码的经验吗?或者官方是否有关于前端代码的文档。 官方文档大多都是配置后端的。
谢谢。

@AndyFong
Copy link
Contributor

AndyFong commented Jun 1, 2020

@AndyFong AndyFong changed the title how compile fornt code ? how compile front-end code ? Jun 1, 2020
@legend91325
Copy link
Author

ref:
https://github.com/edp963/davinci/blob/master/CONTRIBUTING-CH.md#%E5%89%8D%E7%AB%AF

the document about front code is too simple, when compile, always have some error information.

@legend91325
Copy link
Author

ref:
https://github.com/edp963/davinci/blob/master/CONTRIBUTING-CH.md#%E5%89%8D%E7%AB%AF

run commond "npm run build ", after that ,the error info is :
No bundles were parsed. Analyzer will show only original module sizes from stats file.

557AFA09-5377-4543-AA1C-642E8FCAA8E1

@AndyFong
Copy link
Contributor

AndyFong commented Jun 2, 2020

the image-webpack-loader was not installed properly, may caused by the network blocking.
Try to use nrm to switch the mirror address:

npm i nrm -g
nrm use taobao
cd webapp
rm -rf node_modules
npm i
npm run build

@legend91325
Copy link
Author

legend91325 commented Jun 2, 2020

@AndyFong 多谢,最后搞定了。我的问题是在windows环境无法成功安装依赖。
遇到问题如下:
imagemin/imagemin-pngquant#46
解决方案:

  1. 改为在unbunt 环境, 提前安装
    apt-get install libpng-dev
  2. 把项目名重命名为 webapp, 不理解为啥要改文件名,官方也没有人来释义下?
  3. 使用淘宝的cnpm 安装
  4. server/index.js 文件修改代码
    app.listen(port, host, async err => {
    if (err) {
    return logger.error(err.message)
    }

logger.appStarted(port, prettyHost)})

改为

app.listen(port, host)
懂的可以解释下

最后虽然也会有依赖包安装失败,但是把安装失败的手动安装下即可了。

之后
npm start
npm build
均可正常运行了。
上面有些操作 ,我不太懂前端,也不知道具体原理。 如果有懂的可以解释下。

问题我关闭了,因为我的问题已经解决。接下来我们尝试接入我们自己内部的部署服务,有问题再重新开issues 。

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

2 participants