Guest User

Untitled

a guest
Mar 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. class BublePlugin {
  2. apply(compiler) {
  3. compiler.plugin('emit', (compilation, callback) => {
  4. compilation.chunks.forEach(chunk => {
  5. chunk.files.forEach(function(filename) {
  6. if (/\.js$/.test(filename)) {
  7. const source = compilation.assets[filename].source()
  8. , __buble = buble.transform(source)
  9. compilation.assets[filename] = {
  10. source() {
  11. return __buble.code
  12. },
  13. size() {
  14. return __buble.code.length
  15. }
  16. }
  17. }
  18. })
  19. })
  20. callback()
  21. })
  22. }
  23. }
Add Comment
Please, Sign In to add comment