Skip to content

Commit

Permalink
fix: bundle browser build (#1988)
Browse files Browse the repository at this point in the history
Co-authored-by: Artem Zakharchenko <kettanaito@gmail.com>
  • Loading branch information
thepassle and kettanaito authored Jan 22, 2024
1 parent bc0bea6 commit 1cbf615
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from './config/plugins/esbuild/copyWorkerPlugin'
import { resolveCoreImportsPlugin } from './config/plugins/esbuild/resolveCoreImportsPlugin'
import { forceEsmExtensionsPlugin } from './config/plugins/esbuild/forceEsmExtensionsPlugin'
import packageJson from './package.json'

// Externalize the in-house dependencies so that the user
// would get the latest published version automatically.
Expand Down Expand Up @@ -62,6 +63,17 @@ const browserConfig: Options = {
splitting: false,
sourcemap: true,
dts: true,
noExternal: Object.keys(packageJson.dependencies).filter((packageName) => {
/**
* @note Never bundle MSW core so all builds reference the *same*
* JavaScript and TypeScript care files. This way types across
* export paths remain compatible:
* import { http } from 'msw' // <- core
* import { setupWorker } from 'msw/browser' // <- /browser
* setupWorker(http.get(path, resolver)) // OK
*/
return !mswCore.test(packageName)
}),
/**
* @note Use a proxy TypeScript configuration where the "compilerOptions.composite"
* option is set to false.
Expand Down

0 comments on commit 1cbf615

Please sign in to comment.