How to convert laravel mix webpack config into bun bundler

687 Views Asked by At
const mix = require('laravel-mix');

mix
  .alias({
    '@app1': './resources/app1/src',
    '@app2': './resources/app2/src',
  });

mix
  .ts('resources/app1/src/index.tsx', 'js/app1.js')
  .ts('resources/app2/src/index.tsx', 'js/app2.js')
  .react();

mix
  .sass('resources/astnext/src/styles/app1.scss', 'css/app1.css')
  .sass('resources/astnext/src/styles/app2.scss', 'css/app2.css')
  .options({
    processCssUrls: false,
    postCss: [require('tailwindcss')],
  });

if (mix.inProduction()) {
  mix
    .version()
    .sourceMaps(false);
}
1

There are 1 best solutions below

1
On
  • Install the most recent version of Bun globally, use the following command:
npm install -g bun

Alternative installation methods can be found in the documentation. Please refer to the documentation for more details.

  • Replace all instances of npm run ... commands in the package.json file with bun ...

I have not conducted testing; this substitution should work, as Bun serves as a wrapper.