{"id":15080705,"url":"https://github.com/wavevision/nette-webpack","last_synced_at":"2026-03-20T01:27:34.642Z","repository":{"id":37530651,"uuid":"242155216","full_name":"wavevision/nette-webpack","owner":"wavevision","description":" 📦 @webpack adapter for @nette framework","archived":true,"fork":false,"pushed_at":"2023-01-07T15:08:07.000Z","size":1695,"stargazers_count":4,"open_issues_count":10,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-14T21:53:40.889Z","etag":null,"topics":["adapter","di-extension","extension","nette","nette-webpack","webpack","webpack-helper"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/wavevision.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-21T14:16:15.000Z","updated_at":"2024-07-28T14:26:04.000Z","dependencies_parsed_at":"2023-02-07T12:16:35.479Z","dependency_job_id":null,"html_url":"https://github.com/wavevision/nette-webpack","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavevision%2Fnette-webpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavevision%2Fnette-webpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavevision%2Fnette-webpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavevision%2Fnette-webpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavevision","download_url":"https://codeload.github.com/wavevision/nette-webpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235399012,"owners_count":18983814,"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":["adapter","di-extension","extension","nette","nette-webpack","webpack","webpack-helper"],"created_at":"2024-09-25T05:05:24.132Z","updated_at":"2025-10-05T12:32:16.577Z","avatar_url":"https://github.com/wavevision.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/wavevision\"\u003e\u003cimg alt=\"Wavevision s.r.o.\" src=\"https://wavevision.com/images/wavevision-logo.png\" width=\"120\" /\u003e\u003c/a\u003e\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eNette Webpack\u003c/h1\u003e\n\n[![CI](https://github.com/wavevision/nette-webpack/workflows/CI/badge.svg)](https://github.com/wavevision/nette-webpack/actions/workflows/ci.yml)\n[![PHPStan](https://img.shields.io/badge/style-level%20max-brightgreen.svg?label=phpstan)](https://github.com/phpstan/phpstan)\n[![Coverage Status](https://coveralls.io/repos/github/wavevision/nette-webpack/badge.svg?branch=master)](https://coveralls.io/github/wavevision/nette-webpack?branch=master)\n[![Release](https://img.shields.io/github/v/tag/wavevision/nette-webpack?label=version\u0026sort=semver)](https://github.com/wavevision/nette-webpack/releases)\n\nWebpack adapter for Nette framework consisting of:\n\n- [DI extension](#di-extension)\n- entry point chunks resolver **(uses webpack `manifest.json`)**\n- UI components to render assets `\u003cscript\u003e` and `\u003clink\u003e` tags\n- [webpack config helper](#webpack-helper) to manage your setup consistently with `neon` files\n\n## Installation\n\nInstall the DI extension via [Composer](https://getcomposer.org).\n\n```bash\ncomposer require wavevision/nette-webpack\n```\n\nThe webpack helper can be installed via [Yarn](https://yarnpkg.com)\n\n```bash\nyarn add --dev @wavevision/nette-webpack\n```\n\nor [npm](https://npmjs.com)\n\n```bash\nnpm install --save-dev @wavevision/nette-webpack\n```\n\n## Usage\n\n### DI extension\n\nRegister DI extension in your app config.\n\n```neon\nextensions:\n    webpack: Wavevision\\NetteWebpack\\DI\\Extension(%debugMode%, %consoleMode%)\n```\n\nYou can configure the extension as follows _(default values)_.\n\n```neon\nwebpack:\n    debugger: %debugMode%\n    devServer:\n        enabled: %debugMode%\n        url: http://localhost:9006\n    dir: %wwwDir%/dist\n    dist: dist\n    entries: []\n    manifest: manifest.json\n```\n\n- **`debugger: boolean`** – enable [Tracy](https://github.com/nette/tracy) panel with useful development information\n- **`devServer.enabled: boolean`** – serve assets from `webpack-dev-server`\n- **`devServer.url: string`** – `webpack-dev-server` public URL\n- **`dir: string`** – absolute path to webpack build directory\n- **`dist: string`** – webpack build directory name\n- **`entries: Record\u003cstring, boolean\u003e`** – webpack entry points that should be considered when resolving assets\n- **`manifest: string`** – webpack manifest name\n\nThen, setup entry chunks.\n\n```php\nuse Nette\\Application\\UI\\Presenter;\nuse Wavevision\\NetteWebpack\\InjectResolveEntryChunks;\nuse Wavevision\\NetteWebpack\\UI\\Components\\Assets\\AssetsComponent;\n\nfinal class AppPresenter extends Presenter\n{\n\n    use AssetsComponent;\n    use InjectResolveEntryChunks;\n\n    public function actionDefault(): void\n    {\n        $this\n            -\u003egetAssetsComponent()\n            -\u003esetChunks($this-\u003eresolveEntryChunks-\u003eprocess('entry'));\n    }\n}\n```\n\n\u003e **Note:** Entry chunks are resolved based on webpack `manifest.json`. You can also\n\u003e set chunks manually and/or separately with `setScripts` and `setStyles` methods.\n\nFinally, render `assets` in your layout.\n\n```latte\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\t\u003chead\u003e\n\t\t\u003cmeta charset=\"UTF-8\"\u003e\n\t\t\u003cmeta name=\"viewport\" content=\"width=device-width\"\u003e\n\t\t\u003ctitle\u003eWavevision Nette Webpack\u003c/title\u003e\n\t\t{control assets:styles}\n\t\u003c/head\u003e\n\t\u003cbody\u003e\n\t\t{include content}\n\t\t{control assets:scripts}\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\nShould you need it, you can inject and use following services to further customize your setup:\n\n- [`NetteWebpack`](./src/NetteWebpack/NetteWebpack.php) – provides basic methods to work with the extension\n- [`FormatAssetName`](./src/NetteWebpack/FormatAssetName.php) – formats and resolves asset URL based on provided name\n- [`FormatChunkName`](./src/NetteWebpack/FormatChunkName.php) – formats chunk names for specific content types and\n  resolves their URL\n\n### Webpack helper\n\nThis simple utility will help you to manage your project setup and webpack configs consistently. It will also provide\nyou with pre-configured [webpack-manifest-plugin](https://github.com/danethurber/webpack-manifest-plugin) to\ngenerate `manifest.json`\nwith extra `chunks` property that is used to dynamically resolve entry chunks in your application.\n\n```typescript\nimport { WebpackHelper } from '@wavevision/nette-webpack';\n```\n\nThe helper constructor accepts following arguments:\n\n- **`neonPath?: string`** – path to a `neon` in which `webpack` is configured (if not provided, default values will be\n  used)\n- **`wwwDir: string`** – mandatory path to application `wwwDir`\n- **`manifestOptions?: WebpackManifestPlugin.Options`** – if you need to customize manifest plugin setup, you can do it\n  here\n\nThe returned class exposes following methods:\n\n- **`createManifestPlugin(): WebpackManifestPlugin`** – creates manifest plugin instance\n- **`getDevServerPublicPath(): string`** – returns resolved `webpack-dev-server` URL with `dist` included in path\n- **`getDevServerUrl(): UrlWithParsedQuery`** – returns `webpack-dev-server` parsed URL object\n- **`getDist(): string`** – returns `dist` parameter\n- **`getEntries(): Record\u003cstring, boolean\u003e`** – returns records of configured webpack entries\n- **`getEnabledEntries(): string[]`** – returns list of webpack entries that have `true` configured\n- **`getManifest(): string`** – returns webpack manifest file name\n- **`getOutputPath(): string`** – returns resolved path to webpack output directory\n- **`parseNeonConfig\u003cT extends NeonConfig\u003e(): T`** – returns parsed `neon` config (throws error if `neonPath` is not\n  defined)\n\n\u003e **Note:** You can also import `Neon` helper if you want to parse and work with more `neon` files.\n\nSee [example webpack config](./examples/webpack.config.ts) to see it all in action.\n\n## Credits\n\nMany️ 🙏 to [Jiří Pudil](https://github.com/jiripudil) for\nhis [WebpackNetteAdapter](https://github.com/o2ps/WebpackNetteAdapter) which we used in our projects and served as an\ninspiration for this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavevision%2Fnette-webpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavevision%2Fnette-webpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavevision%2Fnette-webpack/lists"}