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

TsConfigPathsPlugin 在某些场景下导致启动需要 7-8 min #369

Closed
dly667 opened this issue Apr 24, 2018 · 24 comments
Closed

TsConfigPathsPlugin 在某些场景下导致启动需要 7-8 min #369

dly667 opened this issue Apr 24, 2018 · 24 comments

Comments

@dly667
Copy link

dly667 commented Apr 24, 2018

`
PS E:\umi-antd-admin - copy> npm start

antd-admin@4.3.9 start E:\umi-antd-admin - copy
cross-env BABELRC=1 BROWSER=none HOST=192.168.0.137 umi dev `

启动很慢大约要6~8分钟

@sorrycc
Copy link
Member

sorrycc commented Apr 24, 2018

能判断出慢在哪里吗?webpack 慢还是 webpack 之前慢?

@dly667
Copy link
Author

dly667 commented Apr 24, 2018

cross-env BABELRC=1 BROWSER=none HOST=192.168.0.137 umi dev
运行到这一步就很慢了。等6分钟左右。出现
[umi-plugin-dll] File list is equal, don't generate the dll file.
这一步,然后就开启成功了。

@sorrycc
Copy link
Member

sorrycc commented Apr 24, 2018

判断不出问题,简单项目快吗?

@dly667
Copy link
Author

dly667 commented Apr 24, 2018

umi简单项目很快。

@sorrycc
Copy link
Member

sorrycc commented Apr 24, 2018

.umirc.js 里删除 umi-plugin-dll 试试,会不会是 dll 影响了。

@dly667
Copy link
Author

dly667 commented Apr 24, 2018

PS E:\umi-antd-admin - copy> npm start

> antd-admin@4.3.9 start E:\umi-antd-admin - copy
> cross-env BABELRC=1 BROWSER=none HOST=192.168.0.137 umi dev

(node:17088) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Plugin [object Object] don't exists.
(node:17088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

删除以后.umirc.js -》 umi-plugin-dll :出现以上错误

@sorrycc
Copy link
Member

sorrycc commented Apr 24, 2018

@dly667
Copy link
Author

dly667 commented Apr 24, 2018

PS E:\umi-antd-admin - copy> npm start

> antd-admin@4.3.9 start E:\umi-antd-admin - copy
> cross-env BABELRC=1 BROWSER=none HOST=192.168.0.137 umi dev
? message

Would you like to run the app on another port instead? Yes
  build [==                  ] 10%
Starting the development server...

  build [=============       ] 65%

删掉以后,再启动话费7分钟。

@sorrycc
Copy link
Member

sorrycc commented Apr 24, 2018

那没啥办法了,机器比较慢?

@xiaohuoni
Copy link
Member

xiaohuoni commented Apr 24, 2018

F:\umi-antd-admin>npm start

> antd-admin@4.3.9 start F:\umi-antd-admin
> cross-env BABELRC=1 BROWSER=none HOST=0.0.0.0 umi dev

⚠️ ⚠️ ⚠️  It\'s not recommended to use webpack.config.js, since it\'s major or minor version upgrades may result in incompatibility. If you insist on doing so,
 please be careful of the compatibility after upgrading.

Build completed in 18.501s

Compiled successfully.

Failed to compile.

./src/components/DataTable/DataTable.js
Module not found: Can't resolve 'utils' in 'F:\umi-antd-admin\src\components\DataTable'

我刚刚下了,在我这里运行,直接就报找不到模块了

@xiaohuoni
Copy link
Member

修改.webpackrc.js

 alias: {
    themes: resolve(__dirname, './src/themes'),
    components: resolve(__dirname,"./src/components"),
    utils: resolve(__dirname,"./src/utils"),
    config: resolve(__dirname,"./src/utils/config"),
    enums: resolve(__dirname,"./src/utils/enums"),
    services: resolve(__dirname,"./src/services"),
    models: resolve(__dirname,"./src/models"),
    routes: resolve(__dirname,"./src/routes")
  },

项目运行成功,功能正常。启动速度很快。

@xiaohuoni
Copy link
Member

不知道你有没有修改过什么东西 @dly667

@superlbr
Copy link
Contributor

安利 develop分支 https://github.com/zuiidea/antd-admin/tree/develop

@dly667
Copy link
Author

dly667 commented Apr 24, 2018

我回家换台机器试试。

@sorrycc sorrycc closed this as completed Apr 24, 2018
@booterhk
Copy link

多台机器都遇到了这样的问题。 有的机器可以启动 有的不可以。

单纯的在一个空目录执行 umi dev 也超级慢 。 问题应该出在 umi 本身

执行后无任何日志。

@xiaohuoni
Copy link
Member

能大致描述一下,出现问题的机器的配置和系统吗?

@sorrycc
Copy link
Member

sorrycc commented Apr 26, 2018

@xiaohuoni 你也是 windows? dev 和 build 的时间大致是多少?

@xiaohuoni
Copy link
Member

都比较快,比较慢的情况下,20来秒。有时候会出现出不来的情况,这个事情我在群里反应过,好像好几个和我一样的。偶尔第一次启动,不刷新的话,要等很久。

@haorui1130
Copy link

@sorrycc 你好,我碰到了一样的问题,我是mac环境,node v9.11.1, npm v5.6.0

@ start /Users/***/demo
umi dev(在这里卡大概8分钟左右才能成功,期间看node进程cpu使用率100%)

@HengCC
Copy link

HengCC commented Apr 26, 2018

@sorrycc 执行 npm start 我测试过. 在同样的的机器配置下.(macbook pro) . 有的可以很快的执行.有的卡10分钟左右才能出来. 理论上和dva脚手架无关, 因为还没有到打包的那一步,纯粹的是卡在启动dev server上.而且单纯的安装umi, 然后new一个空的目录, 之后执行 umi dev. 不同机器也会出现上面的情况. 并且观察进程 node进程一直卡在启动脚本上. cpu 持续100%. 且ctrl+c结束后, node进程也一直停留.

而正常启动的机器.基本在10秒不到就能编译成功. 不知道是否和操作系统版本或者系统环境有关.

@sorrycc
Copy link
Member

sorrycc commented Apr 27, 2018

之前有人排查过好像是 TsConfigPathsPlugin 的问题, @haorui1130 @HengCC 你们试试找个地方执行以下步骤看会不会卡住,

  1. 安装依赖
$ npm install awesome-typescript-loader
  1. 新建文件 test.js
const { TsConfigPathsPlugin } = require('awesome-typescript-loader');
new TsConfigPathsPlugin();
  1. 执行
$ node test.js

@haorui1130
Copy link

console.log('11111111');
new TsConfigPathsPlugin();
console.log('22222222');

@sorrycc 我加了两个log,“11111111”的打印和“22222222”之间过了7-8分钟,期间node进程cpu将近100%

@sorrycc sorrycc changed the title 启动 umi-antd-admin很慢 TsConfigPathsPlugin 在某些场景下导致启动需要 7-8 min Apr 27, 2018
@sorrycc sorrycc reopened this Apr 27, 2018
@sorrycc
Copy link
Member

sorrycc commented May 9, 2018

我先通过环境变量增加开关禁用这个插件, @haorui1130 有空的话可以再帮忙定位下 node_modules/awesome-typescript-loader/dist/paths-plugins.js 这个文件在哪里卡住的。

sorrycc added a commit that referenced this issue May 9, 2018
@sorrycc
Copy link
Member

sorrycc commented Jun 26, 2018

默认已禁用此选项。

@sorrycc sorrycc closed this as completed Jun 26, 2018
sorrycc pushed a commit that referenced this issue Jun 23, 2022
* fix(plugin-docs): Added HTML title

* fix(plugin-docs): Move HTML title into theme config instead of hard coded
xierenyuan pushed a commit to xierenyuan/umi that referenced this issue Jun 23, 2022
* fix(plugin-docs): Added HTML title

* fix(plugin-docs): Move HTML title into theme config instead of hard coded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants