{"id":15753722,"url":"https://github.com/marella/require.js","last_synced_at":"2025-03-31T07:42:32.243Z","repository":{"id":57354346,"uuid":"49192103","full_name":"marella/require.js","owner":"marella","description":"Small AMD loader for bundled AMD modules. No dynamic loading or loader plugin support.","archived":false,"fork":false,"pushed_at":"2016-01-07T09:41:40.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-07T01:19:17.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/marella.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":"2016-01-07T08:35:00.000Z","updated_at":"2024-12-12T13:14:19.000Z","dependencies_parsed_at":"2022-09-02T15:52:24.055Z","dependency_job_id":null,"html_url":"https://github.com/marella/require.js","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Frequire.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Frequire.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Frequire.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Frequire.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marella","download_url":"https://codeload.github.com/marella/require.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246436052,"owners_count":20776960,"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-10-04T07:41:48.700Z","updated_at":"2025-03-31T07:42:32.216Z","avatar_url":"https://github.com/marella.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Small AMD loader for bundled AMD modules. No dynamic loading or loader plugin support.\n\n### define (id, deps, factory)\n\nargument|type\n---:|---\nid|string\ndeps|array\nfactory|function\n\nAll modules must have IDs and dependency arrays in their define() calls. [See AMD define()](https://github.com/amdjs/amdjs-api/blob/master/AMD.md#define-function-).\n\n```js\ndefine('dep1', [], function() {\n});\n\ndefine('dep2', [], function() {\n});\n\ndefine('module1', ['dep1', 'dep2'], function(dep1, dep2) {\n\t// initial setup\n\treturn {\n\t\t// exports\n\t};\n});\n```\n\n### require (id)\n\nargument|type\n---:|---\nid|string\n\nSynchronously returns the module export for the module ID represented by the `id` argument. Modules and all dependencies must be defined before calling this function as it does not do dynamic loading. [See AMD require()](https://github.com/amdjs/amdjs-api/blob/master/require.md#requirestring-).\n\n```js\nvar $ = require('jquery');\n```\n\n```js\ndefine('module1', ['dep1'], function(dep1) {\n\tvar dep2 = require('dep2'); // get dependency\n\t// initial setup\n\treturn {\n\t\t// exports\n\t};\n});\n```\n\n```js\nrequire('main'); // run main module\n```\n\n### Usage\n```bash\nnpm install require.js\n```\nBundle *require.js* with other scripts. It should be added before named or bundled AMD modules.\n```js\nconcat([\n\t'node_modules/require.js/require.min.js', // require.js - define() and require() functions are available from this point\n\t'node_modules/jquery/dist/jquery.min.js', // jquery is registered as a named amd module 'jquery'\n\t'src/js/**/*.js' // named amd modules\n]);\n```\n\n```js\nconcat([\n\t'node_modules/jquery/dist/jquery.min.js', // jquery is registered as a global variable '$'\n\t'node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js', // bootstrap does not support amd\n\t'node_modules/require.js/require.min.js', // require.js - define() and require() functions are available from this point\n\t'src/js/**/*.js' // named amd modules\n]);\n```\n\nIt can also be included before bundled amd modules.\n```js\nconcat([\n\t'node_modules/require.js/require.min.js', // require.js - define() and require() functions are available from this point\n\t'build/js/app.build.js' // bundled amd modules - build tool should assign ids and deps array for each module\n]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarella%2Frequire.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarella%2Frequire.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarella%2Frequire.js/lists"}