From c3b019f13f433e110f00aad39ea9163c144a4044 Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Sun, 9 Jun 2024 08:13:29 +0200 Subject: [PATCH] Avoid including MSW in the bundle --- package-lock.json | 4 ++-- public/test-umd.html | 42 ++++++++++++++++++++++++++++++++++++++++++ vite.config.min.ts | 3 ++- vite.config.ts | 3 ++- 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 public/test-umd.html diff --git a/package-lock.json b/package-lock.json index a1d07c9..687eb3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fakerest", - "version": "3.5.0", + "version": "4.0.0-beta.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fakerest", - "version": "3.5.0", + "version": "4.0.0-beta.0", "license": "MIT", "dependencies": { "lodash": "^4.17.21" diff --git a/public/test-umd.html b/public/test-umd.html new file mode 100644 index 0000000..42f7c99 --- /dev/null +++ b/public/test-umd.html @@ -0,0 +1,42 @@ + + + Test + + + + + + diff --git a/vite.config.min.ts b/vite.config.min.ts index 7a36c0b..ab52308 100644 --- a/vite.config.min.ts +++ b/vite.config.min.ts @@ -17,12 +17,13 @@ export default defineConfig({ rollupOptions: { // make sure to externalize deps that shouldn't be bundled // into your library - external: ['lodash'], + external: ['lodash', 'msw'], output: { // Provide global variables to use in the UMD build // for externalized deps globals: { lodash: '_', + msw: 'MockServiceWorker', }, }, }, diff --git a/vite.config.ts b/vite.config.ts index 27f1ecc..66bc0ef 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -18,12 +18,13 @@ export default defineConfig({ rollupOptions: { // make sure to externalize deps that shouldn't be bundled // into your library - external: ['lodash'], + external: ['lodash', 'msw'], output: { // Provide global variables to use in the UMD build // for externalized deps globals: { lodash: '_', + msw: 'MockServiceWorker', }, }, },