@@ -6,8 +6,6 @@ import { builtinModules } from 'node:module'
66import path from 'node:path'
77import { fileURLToPath } from 'node:url'
88
9- import { getLocalPackageAliases } from '../scripts/utils/get-local-package-aliases.mjs'
10-
119const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
1210const rootPath = path . join ( __dirname , '..' )
1311const srcPath = path . join ( rootPath , 'src' )
@@ -181,43 +179,6 @@ function createPathShorteningPlugin() {
181179 }
182180}
183181
184- /**
185- * Plugin to handle local package aliases.
186- * Provides consistent alias resolution across all Socket repos.
187- * Note: Does not externalize @socketsecurity/lib - that should be bundled.
188- */
189- function createAliasPlugin ( ) {
190- const aliases = getLocalPackageAliases ( rootPath )
191-
192- // Only create plugin if we have local aliases
193- if ( Object . keys ( aliases ) . length === 0 ) {
194- return null
195- }
196-
197- return {
198- name : 'local-package-aliases' ,
199- setup ( build ) {
200- // Intercept imports for aliased packages (except @socketsecurity/lib which should be bundled)
201- for ( const [ packageName , _aliasPath ] of Object . entries ( aliases ) ) {
202- // Skip @socketsecurity /lib - it should be bundled, not externalized
203- if ( packageName === '@socketsecurity/lib' ) {
204- continue
205- }
206-
207- // Match both exact package name and subpath imports
208- build . onResolve (
209- { filter : new RegExp ( `^${ packageName } (/|$)` ) } ,
210- args => {
211- // Mark as external using the original package name to avoid absolute paths in output.
212- // This ensures require('@socketsecurity/lib') instead of require('/absolute/path/to/socket-lib/dist').
213- return { path : args . path , external : true }
214- } ,
215- )
216- }
217- } ,
218- }
219- }
220-
221182// Build configuration for CommonJS output
222183export const buildConfig = {
223184 entryPoints : [ `${ srcPath } /index.ts` ] ,
@@ -238,8 +199,8 @@ export const buildConfig = {
238199 // Preserve module structure for better tree-shaking
239200 splitting : false ,
240201
241- // Use plugins for local package aliases and path shortening
242- plugins : [ createPathShorteningPlugin ( ) , createAliasPlugin ( ) ] . filter ( Boolean ) ,
202+ // Use plugins for path shortening
203+ plugins : [ createPathShorteningPlugin ( ) ] ,
243204
244205 // External dependencies
245206 external : [
0 commit comments