Skip to content

Commit

Permalink
review(ap): externalize graceful-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaskiewicz committed Apr 10, 2024
1 parent f0b7596 commit 5d94926
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/esbuild/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { bundleExternal, sysNodeBundleCacheDir } from '../bundles/sys-node';
import { getBanner } from '../utils/banner';
import { type BuildOptions, createReplaceData } from '../utils/options';
import { writePkgJson } from '../utils/write-pkg-json';
import { getBaseEsbuildOptions, getEsbuildAliases, getFirstOutputFile, runBuilds } from './util';
import { externalAlias, getBaseEsbuildOptions, getEsbuildAliases, getFirstOutputFile, runBuilds } from './util';

const CONNECTOR_NAME = 'connector.html';

Expand Down Expand Up @@ -76,8 +76,6 @@ export async function buildDevServer(opts: BuildOptions) {
'./ws.js',
// open-in-editor-api is externally bundled
'./open-in-editor-api',
// prevent graceful-fs from being inlined in the bundle, saving us ~20kb
'graceful-fs',
];

const devServerAliases = getEsbuildAliases();
Expand Down Expand Up @@ -108,7 +106,12 @@ export async function buildDevServer(opts: BuildOptions) {
format: 'cjs',
platform: 'node',
write: false,
plugins: [esm2CJSPlugin(), contentTypesPlugin(opts), replace(createReplaceData(opts))],
plugins: [
esm2CJSPlugin(),
contentTypesPlugin(opts),
replace(createReplaceData(opts)),
externalAlias('graceful-fs', '../sys/node/graceful-fs.js'),
],
banner: {
js: getBanner(opts, `Stencil Dev Server Process`, true),
},
Expand Down

0 comments on commit 5d94926

Please sign in to comment.