-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 sourcemap exclude vendors and auto turn on only for dev
- Loading branch information
Showing
5 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/cli/src/plugins/excludeVendorsFromSourceMapPlugin.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import fs from 'node:fs/promises'; | ||
|
||
import { createLogger } from '../logger.mjs'; | ||
|
||
export function excludeVendorsFromSourceMapPlugin({ cliConfig }) { | ||
const logger = createLogger('excludeVendorsFromSourceMapPlugin', cliConfig); | ||
|
||
return { | ||
name: 'excludeVendorsFromSourceMapPlugin', | ||
setup(build) { | ||
build.onLoad({ filter: /node_modules/ }, async (args) => { | ||
const contents = await fs.readFile(args.path, { encoding: 'utf8' }); | ||
|
||
return { | ||
contents: contents | ||
+ '\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==', | ||
loader: 'default', | ||
} | ||
}) | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters