{"id":18395348,"url":"https://github.com/unmyke/app-json-config-loader","last_synced_at":"2026-04-29T01:33:04.552Z","repository":{"id":34560233,"uuid":"180326421","full_name":"unmyke/app-json-config-loader","owner":"unmyke","description":"JSON configuration loader for Webpack","archived":false,"fork":false,"pushed_at":"2023-01-04T21:43:05.000Z","size":2544,"stargazers_count":0,"open_issues_count":18,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-22T01:37:08.628Z","etag":null,"topics":["javascript","loader","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/unmyke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-04-09T08:58:28.000Z","updated_at":"2021-07-28T09:05:53.000Z","dependencies_parsed_at":"2023-01-15T08:00:30.181Z","dependency_job_id":null,"html_url":"https://github.com/unmyke/app-json-config-loader","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unmyke%2Fapp-json-config-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unmyke%2Fapp-json-config-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unmyke%2Fapp-json-config-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unmyke%2Fapp-json-config-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unmyke","download_url":"https://codeload.github.com/unmyke/app-json-config-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248574910,"owners_count":21127088,"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":["javascript","loader","webpack"],"created_at":"2024-11-06T02:10:25.092Z","updated_at":"2026-04-29T01:32:59.527Z","avatar_url":"https://github.com/unmyke.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/webpack/webpack\"\u003e\n    \u003cimg width=\"200\" height=\"200\" src=\"https://webpack.js.org/assets/icon-square-big.svg\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003c!-- [![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![deps][deps]][deps-url]\n[![tests][tests]][tests-url]\n[![chat][chat]][chat-url] --\u003e\n\n# app-json-config-loader\n\nLoads configuration as declared in the `json`-file scopes. Loader uses [get-json-config] as core to get scopes of configuration you stored. Tranform list of scopes of configuration to configuration object at build by [webpack] allows you to divide your configuration by scopes (for instance, configuration for api, database, logging modules), define which scopes must be shared between client and server and which must not be shared (database credentails must not to included to cleint bundle).\n\n## Requirements\n\nThis module requires a minimum of Node v6.9.0 and Webpack v4.0.0.\n\n## Getting Started\n\nTo begin, you'll need to install `app-json-config-loader`:\n\n```console\n$ npm install --save-dev app-json-config-loader\n```\n\nThen add the loader to your `webpack` config. For example:\n\n```json\n// config/api.json\n{\n  \"production\": {\n    \"endPoint\": \"/api/v1\"\n  },\n  \"development\": {\n    \"endPoint\": \"/dev_api/\"\n  },\n  \"test\": {\n    \"endPoint\": \"/dev_api/\"\n  }\n}\n```\n\n```json\n// config/database.json\n{\n  \"production\": {\n    \"host\": \"db.expamle.host\",\n    \"port\": 27017,\n    \"username\": \"produsername\",\n    \"password\": \"prodpassword\"\n  },\n  \"development\": {\n    \"host\": \"localhost\",\n    \"port\": 27017,\n    \"username\": \"devusername\",\n    \"password\": \"devpassword\"\n  },\n  \"test\": {\n    \"host\": \"localhost\",\n    \"port\": 27117,\n    \"username\": \"testusername\",\n    \"password\": \"testpassword\"\n  }\n}\n```\n\n```json\n// src/client/configs.json\n[\"api\"]\n```\n\n```json\n// src/server/configs.json\n[\"api\", \"database\"]\n```\n\n```js\n// webpack.server.config.js\nmodule.exports = (env) =\u003e {\n  module: {\n    rules: [\n      {\n        test: /server\\/configs\\.json$/,\n        use: [\n          {\n            loader: \"app-json-config-loader\",\n            options: {\n              env,                    // default process.env.NODE_ENV || \"development\",\n              configPath: \"./config\"  // default \"./config\",\n            }\n          },\n        ],\n      },\n    ],\n  },\n};\n```\n\n```js\n// src/server/entry.js\nconst config = require('./configs.json');\n\n// if development mode config will be:\n//   {\n//     api:\n//       { endpoint: '/dev_api' },\n//     database: {\n//       host: \"localhost\",\n//       port: 27017,\n//       username: \"devusername\",\n//       password: \"devpassword\"\n//     }\n//   }\n```\n\n```js\n// src/client/entry.js\nconst config = require('./configs.json');\n\n// if production mode config will be:\n//   {\n//     api:\n//       { endpoint: '/dev_api' },\n//   }\n\n```\n\nAnd run `webpack` via your preferred method.\n\n## License\n\n#### [MIT](./LICENSE)\n\n\u003c!-- [npm]: https://img.shields.io/npm/v/app-json-config-loader.svg\n[npm-url]: https://npmjs.com/package/app-json-config-loader\n[node]: https://img.shields.io/node/v/app-json-config-loader.svg\n[node-url]: https://nodejs.org\n[deps]: https://david-dm.org/webpack-contrib/app-json-config-loader.svg\n[deps-url]: https://david-dm.org/webpack-contrib/app-json-config-loader\n[tests]: https://img.shields.io/circleci/project/github/webpack-contrib/app-json-config-loader.svg\n[tests-url]: https://circleci.com/gh/webpack-contrib/app-json-config-loader\n[cover]: https://codecov.io/gh/webpack-contrib/app-json-config-loader/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/webpack-contrib/app-json-config-loader\n[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg\n[chat-url]: https://gitter.im/webpack/webpack --\u003e\n[get-json-config]: https://github.com/unmyke/get-json-config\n[webpack]: https://webpack.js.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funmyke%2Fapp-json-config-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funmyke%2Fapp-json-config-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funmyke%2Fapp-json-config-loader/lists"}