{"id":28837516,"url":"https://github.com/nhn/tui.webpack.safe-umd-plugin","last_synced_at":"2026-04-21T16:37:15.022Z","repository":{"id":65412190,"uuid":"96270494","full_name":"nhn/tui.webpack.safe-umd-plugin","owner":"nhn","description":"Webpack plugin to handle optional dependencies safely when using libraryTarget: umd","archived":false,"fork":false,"pushed_at":"2018-06-27T05:59:13.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-12T05:22:13.285Z","etag":null,"topics":["plugin","tui","umd","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nhn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-05T02:52:23.000Z","updated_at":"2025-05-05T04:16:48.000Z","dependencies_parsed_at":"2023-01-23T10:55:02.470Z","dependency_job_id":null,"html_url":"https://github.com/nhn/tui.webpack.safe-umd-plugin","commit_stats":null,"previous_names":["nhnent/tui.webpack.safe-umd-plugin"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nhn/tui.webpack.safe-umd-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhn%2Ftui.webpack.safe-umd-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhn%2Ftui.webpack.safe-umd-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhn%2Ftui.webpack.safe-umd-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhn%2Ftui.webpack.safe-umd-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nhn","download_url":"https://codeload.github.com/nhn/tui.webpack.safe-umd-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhn%2Ftui.webpack.safe-umd-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260751002,"owners_count":23057069,"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":["plugin","tui","umd","webpack"],"created_at":"2025-06-19T12:31:08.807Z","updated_at":"2026-04-21T16:37:15.014Z","avatar_url":"https://github.com/nhn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# safe-umd-webpack-plugin\n\nWebpack plugin to handle optional dependencies safely when using `libraryTarget: umd`.\n\n## When to use\n\nWhen using `umd` as a libraryTarget with config like :\n\n```js\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    library: ['my', 'module'],\n    libraryTarget: 'umd',\n    filename: 'bundle.js'\n  },\n  externals: {\n    'my-ext-module': {\n      commonjs: 'my-ext-module',\n      commonjs2: 'my-ext-module',\n      amd: 'my-ext-module',\n      root: ['my', 'ext', 'module']\n    }\n  }\n}; \n```\n\nYou can't use optional dependencies for a root (namespace) because of the generated code like :\n\n```js\nroot[\"my\"] = root[\"my\"] || {}, root[\"my\"][\"module\"] = factory(root[\"my\"][\"ext\"][\"module\"]);\n```\n\nThis plugin replace code above to safely access the namespace with code like :\n\n```js\nroot[\"my\"] = root[\"my\"] || {}, root[\"my\"][\"module\"] = factory(root[\"my\"] \u0026\u0026 root[\"my\"][\"ext\"] \u0026\u0026 root[\"my\"][\"ext\"][\"module\"]);\n```\n\n## How to use\n\n### Install\n\n```\nnpm install safe-umd-webpack-plugin --save-dev\n```\n\n### Config\n\n```js\n// webpack.config.js\n\nvar SafeUmdPlugin = require('safe-umd-webpack-plugin');\n\n// ...\nmodule.exports = {\n  // ...\n  plugins: [\n    //...\n    new SafeUmdPlugin()\n  ]\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhn%2Ftui.webpack.safe-umd-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhn%2Ftui.webpack.safe-umd-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhn%2Ftui.webpack.safe-umd-plugin/lists"}