index.js 918 B

12345678910111213141516171819202122232425262728293031
  1. import path from 'path';
  2. import unpluginVueComponents from 'unplugin-vue-components/webpack';
  3. export default function (c, i) {
  4. this.nuxt.hook('build:before', (nuxt, buildOptions) => {
  5. buildOptions.plugins.push(
  6. unpluginVueComponents({
  7. resolvers: [
  8. {
  9. type: 'component',
  10. resolve(componentName) {
  11. if (componentName.startsWith('Validation')) {
  12. // console.log(
  13. // '🚀 ~ file: nuxt.config.js ~ line 230 ~ resolve ~ componentName',
  14. // componentName,
  15. // );
  16. return {
  17. name: componentName,
  18. from: 'vee-validate',
  19. // sideEffects: getSideEffects(importName, options),
  20. };
  21. }
  22. },
  23. },
  24. ],
  25. }),
  26. );
  27. });
  28. this.addPlugin(path.resolve(__dirname, 'plugin.js'));
  29. }