{"id":15693506,"url":"https://github.com/mfellner/webpack-sandboxed","last_synced_at":"2025-05-08T03:57:38.679Z","repository":{"id":142114463,"uuid":"68331823","full_name":"mfellner/webpack-sandboxed","owner":"mfellner","description":"Webpack in a sandbox.","archived":false,"fork":false,"pushed_at":"2017-10-09T15:41:32.000Z","size":236,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-25T00:02:47.238Z","etag":null,"topics":["webpack"],"latest_commit_sha":null,"homepage":"https://runkit.com/mfellner/webpack-sandboxed","language":"TypeScript","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/mfellner.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-15T21:13:35.000Z","updated_at":"2020-07-11T15:50:41.000Z","dependencies_parsed_at":"2023-04-22T14:08:52.828Z","dependency_job_id":null,"html_url":"https://github.com/mfellner/webpack-sandboxed","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfellner%2Fwebpack-sandboxed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfellner%2Fwebpack-sandboxed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfellner%2Fwebpack-sandboxed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfellner%2Fwebpack-sandboxed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mfellner","download_url":"https://codeload.github.com/mfellner/webpack-sandboxed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252317024,"owners_count":21728523,"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":["webpack"],"created_at":"2024-10-03T18:44:43.363Z","updated_at":"2025-05-08T03:57:38.663Z","avatar_url":"https://github.com/mfellner.png","language":"TypeScript","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://cdn.rawgit.com/mfellner/78870f9809fb02e21574d4a68fe3dc0a/raw/1b82032dcee224320c50a63148ecf805cb738f84/webpacksandbox.svg\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n# webpack-sandboxed \u0026nbsp; [![npm version](https://badge.fury.io/js/webpack-sandboxed.svg)](https://badge.fury.io/js/webpack-sandboxed) [![Build Status](https://travis-ci.org/mfellner/webpack-sandboxed.svg?branch=master)](https://travis-ci.org/mfellner/webpack-sandboxed) [![Coverage Status](https://coveralls.io/repos/github/mfellner/webpack-sandboxed/badge.svg?branch=master)](https://coveralls.io/github/mfellner/webpack-sandboxed?branch=master) [![Code Climate](https://codeclimate.com/github/mfellner/webpack-sandboxed/badges/gpa.svg)](https://codeclimate.com/github/mfellner/webpack-sandboxed)\n\nWebpack in a sandbox. Run webpack on a in-memory file system, reading from a source string and outputting results as strings again. This is useful when using webpack for compiling bundles on the fly, e.g. on a web server.\n\n---\n\n### Usage\n\n```js\nimport webpackSandboxed from 'webpack-sandboxed';\n\nconst options = {\n  config: { /* webpack configuration */ },\n  packages: [ /* names of modules to load in the sandbox */ ],\n  includes: [ /* local file paths to load in the sandbox */ ],\n  baseDir: 'base directory to resolve modules'\n};\n\nconst sandbox = await webpackSandboxed(options);\nconst [bundle, stats] = sandbox.run(\"exports = {foo: 'bar'};\");\n```\n\n### API\n\n**`webpackSandboxed(options: Options): WebpackRunner`**\n\nCreate a new instance of `WebpackRunner`.\n\n**`Options`**\n\nOptions to configure webpack and webpack sandboxed.\n\n* `config?: webpack.Configuration` – [webpack configuration](https://webpack.js.org/configuration)\n* `packages?: string[]` – A list of node_modules to load into the virtual file system.\n* `includes?: string[]` – A list of directories to add to the virtual file system.\n* `basedir?: string` – The base directory to resolve modules from. Defaults to the parent directory of the webpack-sandboxed installation.\n\n**`WebpackRunner`**\n\nWebpack sandboxed instance.\n\n* `run(source: string | Buffer): Promise\u003c[WebpackBundle, webpack.Stats]\u003e` – Run webpack asynchronously (delegating to [`WebpackCompiler.run`](https://webpack.js.org/api/node/#run)).\n\n**`WebpackBundle`**\n\nResult of a webpack sandboxed run.\n\n* `[key: string]: Buffer` – The set of files generated by webpack (bundles and assets).\n\n### Example\n\nPlease view the [example](example) directory for a complete example of how to use webpack sandboxed.\n\n### References\n\nThis project was inspired by others:\n\n* https://github.com/webpack/webpack/issues/1562\n* https://github.com/christianalfoni/webpack-bin/issues/106\n* https://github.com/christianalfoni/webpack-bin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfellner%2Fwebpack-sandboxed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmfellner%2Fwebpack-sandboxed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfellner%2Fwebpack-sandboxed/lists"}