MCPcopy
hub / github.com/prisma/prisma / noSideEffectsPlugin

Function noSideEffectsPlugin

helpers/compile/plugins/noSideEffectsPlugin.ts:12–29  ·  view source on GitHub ↗
(pattern: RegExp)

Source from the content-addressed store, hash-verified

10 * @returns
11 */
12export function noSideEffectsPlugin(pattern: RegExp): Plugin {
13 return {
14 name: 'noSideEffectsPlugin',
15 setup(build) {
16 build.onResolve({ filter: pattern }, async (args) => {
17 if (args.pluginData?.resolved === true) {
18 return undefined
19 }
20 args.pluginData = { resolved: true }
21 const { path, ...rest } = args
22
23 const result = await build.resolve(path, rest)
24 result.sideEffects = false
25 return result
26 })
27 },
28 }
29}

Callers 1

nodeRuntimeBuildConfigFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected