{"id":18447780,"url":"https://github.com/stoplightio/webpack","last_synced_at":"2025-04-08T00:32:26.757Z","repository":{"id":33660010,"uuid":"155649387","full_name":"stoplightio/webpack","owner":"stoplightio","description":"Webpack helpers, built on top of webpack-chain.","archived":false,"fork":false,"pushed_at":"2025-01-23T08:08:38.000Z","size":5873,"stargazers_count":1,"open_issues_count":29,"forks_count":1,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-05T22:43:22.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stoplightio.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":"2018-11-01T02:15:34.000Z","updated_at":"2021-12-07T17:56:18.000Z","dependencies_parsed_at":"2023-01-15T02:00:34.480Z","dependency_job_id":null,"html_url":"https://github.com/stoplightio/webpack","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fwebpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fwebpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fwebpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Fwebpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stoplightio","download_url":"https://codeload.github.com/stoplightio/webpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755460,"owners_count":20990618,"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":[],"created_at":"2024-11-06T07:14:24.885Z","updated_at":"2025-04-08T00:32:21.748Z","avatar_url":"https://github.com/stoplightio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack Helpers\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/42f95e29a1fba71d1387/maintainability)](https://codeclimate.com/github/stoplightio/webpack/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/42f95e29a1fba71d1387/test_coverage)](https://codeclimate.com/github/stoplightio/webpack/test_coverage)\n\nPlugins, built around [webpack-chain](https://github.com/neutrinojs/webpack-chain), that make creating webpack configs easier.\n\n- Explore the interfaces: [TSDoc](https://stoplightio.github.io/webpack/)\n- View the changelog: [Releases](https://github.com/stoplightio/webpack/releases)\n\n### Plugins\n\n- **BrowserFS:** Replace the native `fs` module with the BrowserFS equivalent.\n  - Note: must `yarn add browserfs` in your project if using this plugin.\n- **Bugsnag:** Upload sourcemaps to bugsnag.\n- **CSS:** Import css.\n- **Fonts:** Import fonts.\n- **HTML:** Render an html template.\n- **Javascript:** Parse javascript.\n- **Monaco:** Import monaco.\n  - Note: must `yarn add monaco-editor` in your project if using this plugin.\n- **Optimizations:** Minification, chunks, etc.\n- **Presentation:** Better terminal output.\n- **Public:** Use a public assets folder.\n- **Serve:** Serve up a hot reloading dev environment.\n- **Stylus:** Import stylus.\n- **Typescript:** Parse typescript (and optionally also javascript).\n- **Web Workers:** Import web workers.\n\n### Installation\n\n```bash\n# latest stable\nyarn add -D @stoplight/webpack\n```\n\n### Usage\n\nIn your `webpack.config.ts` file:\n\n```ts\nimport { createConfig } from \"@stoplight/webpack\";\nimport * as path from \"path\";\nimport webpack from \"webpack\";\n\nimport { buildEnv } from \"./env\";\n\nconst isElectron = process.env.RUN_CONTEXT === \"desktop\";\n\nconst config: webpack.Configuration = createConfig({\n  srcDir: path.resolve(process.cwd(), \"src\"),\n  distDir: isElectron\n    ? path.resolve(process.cwd(), \"desktop\", \"src\", \"dist\")\n    : path.resolve(\"desktop\", \"src\", \"dist\"),\n  publicDir: path.resolve(process.cwd(), \"src\", \"public\"),\n  isElectron,\n  analyze: false,\n  debug: false,\n  stats: undefined,\n  plugins: {\n    browserfs: isElectron ? undefined : {},\n    bugsnag: undefined,\n    css: undefined,\n    fonts: {},\n    html: {\n      // string to assign to the head title tag\n      title: \"Stoplight Studio\",\n\n      // object to assign to window.env in a head tag script\n      env: buildEnv(),\n\n      // string of html to be inserted towards the top of the head tag\n      metaHtml: \"\",\n\n      // string of html to be inserted towards the bottom of the head tag\n      headHtml: \"\",\n\n      // string of html to be inserted towards the bottom of the body tag\n      bodyHtml: \"\"\n    },\n    javascript: undefined,\n    monaco: {},\n    optimizations: {},\n    presentation: {},\n    public: undefined,\n    serve: {},\n    stylus: undefined,\n    typescript: {},\n    workers: undefined\n  },\n  onBeforeBuild: _config =\u003e {\n    // ...do whatever you want w config, which is an instance of webpack-chain\n  }\n});\n\nexport default config;\n```\n\n### Contributing\n\n1. Clone repo\n2. Create / checkout `feature/{name}`, `chore/{name}`, or `fix/{name}` branch\n3. Install deps: `yarn setup`\n4. Make your changes\n5. Run tests: `yarn test.prod`\n6. Stage relevant files to git\n7. Commit: `yarn commit`. _NOTE: Commits that don't follow the [conventional](https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional) format will be rejected. `yarn commit` creates this format for you, or you can put it together manually and then do a regular `git commit`._\n8. Push: `git push`\n9. Open PR targeting the `develop` branch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Fwebpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoplightio%2Fwebpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Fwebpack/lists"}