{"id":19737763,"url":"https://github.com/softwareventures/webpack-config","last_synced_at":"2025-04-30T05:30:39.297Z","repository":{"id":37686755,"uuid":"164084301","full_name":"softwareventures/webpack-config","owner":"softwareventures","description":"Standard webpack configuration for Software Ventures Limited","archived":false,"fork":false,"pushed_at":"2025-04-21T21:03:11.000Z","size":5541,"stargazers_count":0,"open_issues_count":12,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T22:22:06.790Z","etag":null,"topics":["typescript","webpack"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@softwareventures/webpack-config","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softwareventures.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2019-01-04T09:05:17.000Z","updated_at":"2024-12-03T11:58:48.000Z","dependencies_parsed_at":"2023-09-26T00:54:39.727Z","dependency_job_id":"9e6023f0-85c0-4af8-a0f0-2d709aaa1e8a","html_url":"https://github.com/softwareventures/webpack-config","commit_stats":null,"previous_names":[],"tags_count":204,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwareventures%2Fwebpack-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwareventures%2Fwebpack-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwareventures%2Fwebpack-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwareventures%2Fwebpack-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softwareventures","download_url":"https://codeload.github.com/softwareventures/webpack-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251648427,"owners_count":21621332,"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":["typescript","webpack"],"created_at":"2024-11-12T01:12:16.387Z","updated_at":"2025-04-30T05:30:38.964Z","avatar_url":"https://github.com/softwareventures.png","language":"TypeScript","readme":"# webpack-config\n\nSimplified and opinionated webpack configuration.\n\nThis package implements a standard webpack configuration preferred by Software\nVentures Limited, but can also be used by others.\n\n## Why?\n\nConfiguring webpack from scratch is time-consuming and complicated. This package\nprovides a standard webpack configuration that is suitable for most projects.\n\n## Upgrading from v3 or earlier\n\nSee [Upgrade Guide](docs/Upgrade-Guide.md).\n\n## Setup\n\nAdd a dependency on this package, webpack, and webpack-dev-server, for example\nusing npm or yarn:\n\n```\n$ npm install --save-dev @softwareventures/webpack-config webpack webpack-cli webpack-dev-server\n```\n\n```\n$ yarn add --dev @softwareventures/webpack-config webpack webpack-cli webpack-dev-server\n```\n\nCreate a `webpack.config.cjs` file at the root of your project with the\nfollowing contents:\n\n```javascript\nconst config = require(\"@softwareventures/webpack-config\");\n\nmodule.exports = config({\n    title: \"Name of your app\"\n});\n```\n\nwebpack-config exports a single function, `config`. Options may be passed to\n`config` as an object or as a function that returns an object.\n\nThe `config` function itself returns a webpack configuration, which should be\nexported by `webpack.config.cjs`.\n\nWe also recommend that you add a `build` and `start` script to `package.json`:\n\n```json\n{\n    \"scripts\": {\n        \"build\": \"webpack --env production\",\n        \"start\": \"webpack-dev-server --open\"\n    }\n}\n```\n\nSee [Building](#building) and [Dev Server](#dev-server) for more on these\nscripts.\n\n## TypeScript Support\n\nTo enable TypeScript, first add dev dependencies on `ts-loader` and\n`typescript`, and a dependency on `tslib`:\n\n```\nnpm install --save-dev ts-loader typescript\nnpm install --save tslib\n```\n\nor\n\n```\nyarn add --dev ts-loader typescript\nyarn add tslib\n```\n\nThen create a `tsconfig.json` file at the root of your project with the\nfollowing contents:\n\n```json\n{\n    \"extends\": \"@softwareventures/webpack-config/tsconfig/general\",\n    \"compilerOptions\": {\n        \"types\": [\n            \"webpack-env\",\n            \"@softwareventures/webpack-config/webpack-config-runtime\"\n        ]\n    }\n}\n```\n\nwebpack-config provides several preset TypeScript configurations for different\npurposes, which can be used in place of the above:\n\n-   `@softwareventures/webpack-config/tsconfig/general`: General purpose\n    configuration suitable for most projects.\n-   `@softwareventures/webpack-config/tsconfig/general-commonjs`: Same as\n    `general`, but modules are compiled to CommonJS module format instead of\n    ESM. Useful for older projects that are not ready to transition to ESM. Not\n    recommended for new projects.\n-   `@softwareventures/webpack-config/tconfig/preact`: Configuration suitable\n    for projects using JSX with [Preact][1].\n-   `@softwareventures/webpack-config/tconfig/preact-commonjs`: Same as\n    `preact`, but modules are compiled to CommonJS module format instead of ESM.\n    Useful for older projects that are not ready to transition to ESM. Not\n    recommended for new projects.\n-   `@softwareventures/webpack-config/tsconfig/react`: Configuration suitable\n    for projects using JSX with [React][3].\n-   `@softwareventures/webpack-config/tsconfig/react-commonjs` Same as `react`,\n    but modules are compiled to CommonJS module format instead of ESM. Useful\n    for older projects that are not ready to transition to ESM. Not recommended\n    for new projects.\n\nAny of these presets can be used as a base with project-specific overrides. Any\noptions set in `tsconfig.json` will override those set by the preset. See\n[tsconfig.json in the TypeScript Handbook][2] for more information on\nconfiguring TypeScript.\n\n## Building\n\nWe recommend that you set up a script in `package.json` to build your project,\nas follows:\n\n```json\n{\n    \"scripts\": {\n        \"build\": \"webpack --env production\"\n    }\n}\n```\n\nYou can then run the build script using npm or yarn:\n\n```bash\nnpm run build\n```\n\n```bash\nyarn build\n```\n\nBuild output goes in `dist` by default.\n\n## Dev Server\n\nWe recommend that you set up a script in `package.json` to run the dev server,\nas follows:\n\n```json\n{\n    \"scripts\": {\n        \"start\": \"webpack serve --open\"\n    }\n}\n```\n\nYou can then run the dev server using npm or yarn:\n\n```bash\nnpm start\n```\n\n```bash\nyarn start\n```\n\n## See Also\n\n-   [@softwareventures/eslint-config](https://github.com/softwareventures/eslint-config)\n\n[1]: https://preactjs.com/\n[2]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html\n[3]: https://reactjs.org/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwareventures%2Fwebpack-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftwareventures%2Fwebpack-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwareventures%2Fwebpack-config/lists"}