{"id":15789945,"url":"https://github.com/nonblocking/mashroom-dll-webpack-plugin","last_synced_at":"2025-03-31T18:28:19.924Z","repository":{"id":36156460,"uuid":"221875852","full_name":"nonblocking/mashroom-dll-webpack-plugin","owner":"nonblocking","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-24T09:14:23.000Z","size":495,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T03:26:38.818Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/nonblocking.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-11-15T08:10:02.000Z","updated_at":"2022-04-23T16:14:49.000Z","dependencies_parsed_at":"2023-01-16T22:58:43.401Z","dependency_job_id":null,"html_url":"https://github.com/nonblocking/mashroom-dll-webpack-plugin","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/nonblocking%2Fmashroom-dll-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonblocking%2Fmashroom-dll-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonblocking%2Fmashroom-dll-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonblocking%2Fmashroom-dll-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nonblocking","download_url":"https://codeload.github.com/nonblocking/mashroom-dll-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285645,"owners_count":20752947,"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-04T22:04:16.802Z","updated_at":"2025-03-31T18:28:19.904Z","avatar_url":"https://github.com/nonblocking.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Mashroom DLL Webpack Plugin\n\nWebpack plugin that adds *DLLs* as shared resources to [Mashroom Server](https://www.mashroom-server.com) Portal Apps.\n\nThis is useful to share vendor libraries (e.g. React) between multiple Apps, which drastically reduces the bundle sizes.\n\n## Usage\n\n### Bundling the DLL\n\nThere is nothing specific here, just follow the [DLLPlugin](https://webpack.js.org/plugins/dll-plugin/) documentation.\n\nTo bundle React and Redux the *webpack* config in the DLL module would look like this:\n\n```js\nconst path = require('path');\nconst webpack = require('webpack');\n\nmodule.exports = {\n    entry: ['react', 'react-dom', 'redux', 'react-redux'],\n    output: {\n        path: __dirname + '/dist',\n        filename: \"my_dll.js\",\n        // MUST contain the hash!\n        library: \"my_dll_[hash]\"\n    },\n    plugins: [\n        new webpack.DllPlugin({\n            path: path.join(__dirname, \"dist\", \"my_dll_manifest.json\"),\n            // MUST be the same as output.library!\n            name: \"my_dll_[hash]\"\n        })\n    ]\n};\n```\n\n### Using the DLL\n\nIn your App module add this plugin to the dependencies:\n\n```json\n{\n    \"devDependencies\": {\n        \"@mashroom/mashroom-dll-webpack-plugin\": \"^1.0.3\"\n    }\n}\n```\n\nAnd use the *webpack* *DllReferencePlugin* and this plugin to add the library as *sharedResource* to\nthe Portal App:\n\n```js\nconst webpack = require('webpack');\nconst { CleanWebpackPlugin } = require('clean-webpack-plugin');\nconst MashroomWDLLWebpackPlugin = require('@mashroom/mashroom-dll-webpack-plugin');\n\nmodule.exports = {\n    // ...\n    plugins: [\n        new CleanWebpackPlugin(),\n        new MashroomWDLLWebpackPlugin({\n            manifest: require(\"my-dll-module/dist/my_dll_manifest.json\"),\n            dllPath: require.resolve(\"my-dll-module/dist/my_dll.js\")\n        }),\n        new webpack.DllReferencePlugin({\n            manifest: require(\"my-dll-module/dist/my_dll_manifest.json\"),\n        })\n    ],\n}\n```\n\nThis configuration is going to copy the DLL (my_dll.js) to the output path and adds it to the *Mashroom* config in *package.json* like this:\n\n```json\n    \"mashroom\": {\n        \"plugins\": [\n            {\n                \"name\": \"Demo Shared DLL App\",\n                \"type\": \"portal-app\",\n                \"bootstrap\": \"startupDemoSharedDLLApp\",\n                \"sharedResources\": {\n                    \"js\": [\n                        \"my_dll_910502a6fce2f139eff8.js\"\n                    ]\n                },\n                \"resources\": {\n                    \"js\": [\n                        \"bundle.js\"\n                    ]\n                },\n                \"defaultConfig\": {\n                    \"resourcesRoot\": \"./dist\",\n                    \"appConfig\": {}\n                }\n            }\n        ]\n    }\n```\n\n## Demo\n\nSee [Mashroom Demo Shared DLL](https://github.com/nonblocking/mashroom-demo-shared-dll)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonblocking%2Fmashroom-dll-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonblocking%2Fmashroom-dll-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonblocking%2Fmashroom-dll-webpack-plugin/lists"}