{"id":17617692,"url":"https://github.com/ankurk91/laravel-bundler","last_synced_at":"2025-04-18T20:30:45.438Z","repository":{"id":66180796,"uuid":"158683907","full_name":"ankurk91/laravel-bundler","owner":"ankurk91","description":"Modern asset building tool for Laravel framework with better defaults. 📦","archived":false,"fork":false,"pushed_at":"2024-07-25T05:04:57.000Z","size":2086,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T20:45:08.164Z","etag":null,"topics":["esbuild","laravel","laravel-mix","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankurk91.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-22T10:42:39.000Z","updated_at":"2024-07-25T05:04:47.000Z","dependencies_parsed_at":"2023-12-22T08:27:11.499Z","dependency_job_id":"73332067-7b5b-4c61-b4e2-c985d35d707a","html_url":"https://github.com/ankurk91/laravel-bundler","commit_stats":{"total_commits":392,"total_committers":3,"mean_commits":"130.66666666666666","dds":"0.012755102040816313","last_synced_commit":"0e2c5d8397862f16981d0d847304c1b918b3b5d7"},"previous_names":[],"tags_count":80,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankurk91%2Flaravel-bundler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankurk91%2Flaravel-bundler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankurk91%2Flaravel-bundler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankurk91%2Flaravel-bundler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankurk91","download_url":"https://codeload.github.com/ankurk91/laravel-bundler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249543297,"owners_count":21288703,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esbuild","laravel","laravel-mix","webpack"],"created_at":"2024-10-22T19:15:09.091Z","updated_at":"2025-04-18T20:30:45.431Z","avatar_url":"https://github.com/ankurk91.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asset Bundler for Laravel\n\n[![downloads](https://badgen.net/npm/dt/laravel-bundler)](https://npm-stat.com/charts.html?package=laravel-bundler\u0026from=2018-11-01)\n[![npm-version](https://badgen.net/npm/v/laravel-bundler)](https://www.npmjs.com/package/laravel-bundler)\n[![github-tag](https://badgen.net/github/tag/ankurk91/laravel-bundler)](https://github.com/ankurk91/laravel-bundler/tags)\n[![license](https://badgen.net/github/license/ankurk91/laravel-bundler)](LICENSE.txt)\n[![install size](https://packagephobia.com/badge?p=laravel-bundler)](https://packagephobia.com/result?p=laravel-bundler)\n[![tests](https://github.com/ankurk91/laravel-bundler/workflows/tests/badge.svg)](https://github.com/ankurk91/laravel-bundler/actions)\n\nModern and fast asset building tool for Laravel framework with better defaults.\n\n## Installation\n\n:bulb: This package does not work with [laravel-mix](https://github.com/laravel-mix/laravel-mix);\nyou must remove `laravel-mix` before using this one\n\n```bash\nnpm install --save-dev laravel-bundler@^2\n```\n\n## Usage\n\nCreate a `resources/js/app.js` file like\n\n```js\n// Example: Vue.js v2 with bootstrap\nimport Vue from 'vue';\n// You can import styles like this\nimport 'bootstrap/dist/css/bootstrap.css'\n\nimport RegularComponent from './Regular.vue'\n\nconst LazyLoadedComponent = () =\u003e import('./HeavyComponent.vue');\n\nnew Vue({\n    el: \"#app\",\n    components: {\n        RegularComponent,\n        LazyLoadedComponent,\n    }\n});\n```\n\nCreate a `webpack.config.mjs` file on your project root and remove `webpack.mix.js` if exists.\n\n```js\nimport webpack from 'webpack'\nimport {createConfig} from 'laravel-bundler';\nimport vue2Recipe from 'laravel-bundler/src/recipes/vue-2.js';\n\nexport default createConfig({\n        entry: {\n            app: './resources/js/app.js',\n        },\n        plugins: [\n            //\n        ],\n        // Other webpack configs may go here\n    },\n    // Include vue v2 recipe\n    // Dont forget to install required packages by this recipe\n    vue2Recipe\n);\n```\n\nUpdate your `package.json` file\n\n```json\n{\n    \"type\": \"module\",\n    \"scripts\": {\n        \"dev\": \"webpack --define-process-env-node-env=development --progress\",\n        \"watch\": \"webpack watch --define-process-env-node-env=development --progress\",\n        \"hot\": \"webpack serve --define-process-env-node-env=development --progress --hot\",\n        \"hot:https\": \"npm run hot -- --https\",\n        \"prod\": \"webpack --define-process-env-node-env=production --progress\"\n    },\n    \"browserslist\": [\n        \"\u003e 2%\",\n        \"not dead\"\n    ],\n    \"babel\": {\n        \"presets\": [\n            [\n                \"@babel/preset-env\",\n                {\n                    \"bugfixes\": true\n                }\n            ]\n        ],\n        \"plugins\": []\n    }\n}\n```\n\nUpdate your blade template\n\n```blade\n\u003c!-- header --\u003e\n\u003clink href=\"{{ mix('css/app.css', 'dist') }}\" rel=\"stylesheet\"\u003e\n\n\u003c!-- footer --\u003e\n\u003cscript src=\"{{ mix('js/manifest.js', 'dist') }}\"\u003e\u003c/script\u003e\n\u003cscript src=\"{{ mix('js/vendor.js', 'dist') }}\"\u003e\u003c/script\u003e\n\u003cscript src=\"{{ mix('js/app.js', 'dist') }}\"\u003e\u003c/script\u003e\n```\n\nUpdate your `.gitignore` file\n\n```.gitignore\n/public/dist\n```\n\n### Features\n\n* Webpack 5 and Babel 7 with `@babel/preset-env`\n* Use [esbuild](https://esbuild.github.io/) to minify CSS and JS :rocket:\n* Vue.js v2 support - [Recipe](./wiki/vue-js-v2.md)\n* Vue.js v3 support - [Recipe](./wiki/vue-js-v3.md)\n* `CSS` and `SASS|SCSS` support\n* PostCSS loader pre-configured with `autoprefixer`\n* Font and image files handling\n* Full HMR support for Vue, even for CSS :fire:\n* Extract all css to a separate file (based on entry)\n* Accepts css/scss file as entry\n* Extract all vendor js to a separate file\n* Dynamic import (code splitting) support :mage_man:\n* Clean the output directory before emitting the assets\n* Generates a `mix-manifest.json` file which is compatible with Laravel's `mix()` helper\n* Load environment variables from `.env` file that are prefixed with `MIX_` :wink:\n* Intelligent SourceMap based on mode\n* Can auto-reload web-browser when blade templates gets changed :wink:\n\n### Documentation\n\n* [Read the additional docs](./wiki)\n\n### Not in the plan\n\nThese features are not in the plan but can be enabled on demand :man_shrugging:\n\n* [Build Notification](https://github.com/RoccoC/webpack-build-notifier)\n* [Copy files and folder](https://github.com/webpack-contrib/copy-webpack-plugin)\n* [Image compression](https://github.com/webpack-contrib/image-minimizer-webpack-plugin)\n* CSS Preprocessors other than `sass|scss`\n\n## License\n\n[MIT](LICENSE.txt) License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankurk91%2Flaravel-bundler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankurk91%2Flaravel-bundler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankurk91%2Flaravel-bundler/lists"}