migrating webpack to vite

Viewed 27

I am thinking of migrating webpack to vite. My webpack.js is almost 400 lines. Mainly it is copying the assets from the /resources directory to individual directories in themes wordpress. I also have build js files with several different files for each themes. I think if it can be rewritten on vite. What do you think? For example, the fragment I am thinking about:

const THEMES = fs.readdirSync('/resources/path').filter((file) => {
  return fs.statSync('resources/path' + file).isDirectory();
});

for (let theme of THEMES) {
    let css = 'path' + themeName + '/css/main.min.css';
    let scss = 'path' + themeName + '/main.scss';

    mix.sass(scss, css);
}

[...]
mix
      .sass(scss, css)
      .styles(
        [
          'path' + 'first.css',
          'path' + 'path1/css/second.css',
          'wordpress/wp-content/themes/xxx/css/style.min.css',
          css,
        ],
        'wp_build_path' + themeName + '/css/app.min.css',
      );

e.t.c

0 Answers
Related