Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel Mix is compatible with Webpack Cli #1716

Closed
dr5hn opened this issue Sep 27, 2022 · 3 comments
Closed

Laravel Mix is compatible with Webpack Cli #1716

dr5hn opened this issue Sep 27, 2022 · 3 comments
Labels

Comments

@dr5hn
Copy link
Contributor

dr5hn commented Sep 27, 2022

Hi bud team,

I think you need to update the comparison graph, as I see laravel mix is compatible with webpack cli.

Screenshot 2022-09-27 at 11 51 18 AM

https://laravel-mix.com/docs/6.0/cli#pass-options-to-webpack-cli
Screenshot 2022-09-27 at 11 46 46 AM

@kellymears
Copy link
Contributor

kellymears commented Sep 27, 2022

laravel mix uses webpack-cli but that doesn't mean the user can.

in comparison, you can use bud as a helper lib in a normal webpack.config.js file run with webpack-cli directly:

// webpack.config.js

import {factory} from '@roots/bud'

/**
 * For info on configuring webpack with a function or promise:
 * {@link https://webpack.js.org/configuration/configuration-types/#exporting-a-promise}
 */
export default async env => {
  /**
   * Instantiate bud
   */
  const bud = await factory({mode: env.mode})

  /**
   * Set entrypoints and do other config as usual
   */
  bud.entry('app', 'index.js').minimize().splitChunks()

  /**
   * This is our final config object. Return it for webpack.
   */
  return await bud.build.make()
}

it's not an insignificant difference. imagine you have a pre-existing application already set up for webpack-cli (maybe even some gulp scripts on the side). you aren't forced to retool everything and you aren't required to use the bud cli at all. it should be a much more manageable transition.

approaching it from the opposite perspective: if you do have a bud.config.js file you can add a webpack.config.js file to your application root that exports the final config for direct use with webpack-cli:

import {get} from '@roots/bud'

export default async () => (await get()).build.make()

@dr5hn
Copy link
Contributor Author

dr5hn commented Sep 28, 2022

@kellymears Gotcha. Thanks for the explanation.

I believe we can also achieve the same by just installing webpack-cli (within the laravel mix project) and writing the same code within webpack.config.js

@github-actions
Copy link

Message to comment on stale issues. If none provided, will not mark issues stale

@github-actions github-actions bot added the stale label Jan 30, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants