Guest User

Untitled

a guest
Oct 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. class EnableLintAfter1stCompilationPlugin {
  2. constructor() {
  3. this.builds = {
  4. milos: false,
  5. tilos: false,
  6. };
  7. }
  8.  
  9. apply(compiler) {
  10. compiler.plugin('done', (stats) => {
  11. if (stats.compilation.entrypoints.milos) {
  12. this.builds.milos = true;
  13. }
  14. });
  15. compiler.plugin('make', (cmp, cb) => {
  16. if (this.builds.milos && cmp.options.entry.milos) {
  17. cmp.options.module.rules.push({
  18. enforce: 'pre',
  19. test: /\.js$/,
  20. use: {
  21. loader: 'eslint-loader',
  22. options: {
  23. cache: true,
  24. },
  25. },
  26. exclude: /node_modules/,
  27. });
  28. }
  29. cb();
  30. });
  31. }
  32. }
Add Comment
Please, Sign In to add comment