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

第六节课问题收集 #13

Open
zhulin2609 opened this issue Dec 9, 2018 · 6 comments
Open

第六节课问题收集 #13

zhulin2609 opened this issue Dec 9, 2018 · 6 comments

Comments

@zhulin2609
Copy link
Contributor

zhulin2609 commented Dec 9, 2018

今天的作业,大家可以试着做一下homework6

@zhulin2609 zhulin2609 changed the title 第六节课问题手机 第六节课问题收集 Dec 9, 2018
@cuantmac
Copy link

cuantmac commented Dec 16, 2018

阅读webpack源码时发现并不是每个plugin都有 (before-)run 这个开始执行构建的事件钩子,希望老师讲解下原因。那些没有用这个钩子的plugin 都是怎么开始构建的?

@ZhangLynn
Copy link

老师能否讲下在实际项目开发中,自己写的比较好的loader和plugin,因为掌握了loader和plugin写法之后觉得不知道怎么应用到实际项目中,缺乏这块经验和概念

@josephmax
Copy link

两个问题,一个是关于使用happypack和webpack4版本uglify-webpack-plugin
经尝试,使用了happypack创建了js的loader和css的loader,但由于项目没有特别大,速度提升效果不是很明显。大概在什么样的项目规模下充分开启多线程编译能得到性能的提升,有没有相关的经验和参照值可以分享?
同样的问题针对UglifyJS,webpack4以后这个步骤也支持了多线程压缩混淆,同想得到一些实际应用到工程中的配置案例。

@josephmax
Copy link

另一个问题是关于使用dynamic import syntax,
因为项目中使用了react-loadable,有些地方需要借助
() => import('path/to/component')来实现代码分割,这个时候webpack中配置的alias似乎就无法被很好地编译进去了。如果不自己写plugin,有没有现成的方案可以让import动态解析的路径也支持配好的alias呢?�

@miniflycn
Copy link
Member

@zhulin2609 朱老师,来回答下啊。

@zhulin2609
Copy link
Contributor Author

阅读webpack源码时发现并不是每个plugin都有 (before-)run 这个开始执行构建的事件钩子,希望老师讲解下原因。那些没有用这个钩子的plugin 都是怎么开始构建的?

https://www.webpackjs.com/api/compiler-hooks/ plugin触发的事件钩子并不限于(before-)run,emit等也可以的,homework就有提现。

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

5 participants