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

想写个插件在生成js的最前面 插入一段js代码 js代码window.pad = pad pad是传进来的 #22

Closed
wood-liu92 opened this issue Jul 4, 2017 · 8 comments

Comments

@wood-liu92
Copy link

应该怎么在什么时候插入呢? 怎么获取到webpack编译的代码呢?

@lcxfs1991
Copy link
Owner

可以使用,或者参考这个项目:
https://github.com/lcxfs1991/banner-webpack-plugin
@lww555

@wood-liu92
Copy link
Author

15f57187-8993-416e-a0ab-20efd5e3369d

代码已经插入进去了 但是总是报 as2 is not a function 这是怎么回事呢

@lcxfs1991
Copy link
Owner

你有在代码里,调用 window.pad() ?

@wood-liu92
Copy link
Author

image
我在代码里没有调用 window.pad() 。

@lcxfs1991
Copy link
Owner

你多加个分号呢?

@wood-liu92
Copy link
Author

可以了,果然是分号的事。谢谢大神

@wood-liu92
Copy link
Author

最近想写webpack插件 但是看compiler, compilation的源码 完全看不懂啊。需要哪些基础知识呢.
是看 他提供的Plugin API吗?

@lcxfs1991
Copy link
Owner

老早的时候写的,有一定参考价值
lcxfs1991/blog#1
另外这里也有一些文章参考:
https://github.com/webpack-china/awesome-webpack-cn

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