plugin.js 427 B

1234567891011121314151617
  1. const { testWebpack5 } = require('./codegen/utils')
  2. const NS = 'vue-loader'
  3. class VueLoaderPlugin {
  4. apply(compiler) {
  5. let Ctor = null
  6. if (testWebpack5(compiler)) {
  7. // webpack5 and upper
  8. Ctor = require('./plugin-webpack5')
  9. } else {
  10. // webpack4 and lower
  11. Ctor = require('./plugin-webpack4')
  12. }
  13. new Ctor().apply(compiler)
  14. }
  15. }
  16. VueLoaderPlugin.NS = NS
  17. module.exports = VueLoaderPlugin