Skip to content

Commit

Permalink
Revert "drop workaround over esbuild bug fixed upstream"
Browse files Browse the repository at this point in the history
This reverts commit c678f84.

trigger pulled too soon:
- evanw/esbuild#619 was gone
- but then come evanw/esbuild#1958
  • Loading branch information
AntonioMeireles committed Jun 11, 2022
1 parent f33e3e0 commit 229dd7f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion esbuild.config.cjs
Expand Up @@ -2,6 +2,18 @@ const fs = require('fs')

const esbuild = require('esbuild')

// XXX taken from https://github.com/evanw/esbuild/issues/619#issuecomment-751995294
// XXX `plugins: [makeAllPackagesExternalPlugin]` were supposed to be superceeded by
// XXX `external: ['./node_modules/*']` but...
// XXX ... we're blocked by what seems to be https://github.com/evanw/esbuild/issues/1958
const makeAllPackagesExternalPlugin = {
name: 'make-all-packages-external',
setup: (build) => {
const filter = /^[^./]|^\.[^./]|^\.\.[^/]/ // Must not start with "/" or "./" or "../"
build.onResolve({ filter }, (arguments_) => ({ external: true, path: arguments_.path }))
}
}

const catcher = (error) => {
console.error(error)
// eslint-disable-next-line unicorn/no-process-exit
Expand All @@ -22,7 +34,7 @@ const builder = (entryPoints, outdir = 'dist', platform = targets.Node) =>
sourcemap: true,
sourcesContent: false,
...(platform === targets.Node
? { external: ['./node_modules/*'], target: 'node14' }
? { plugins: [makeAllPackagesExternalPlugin], target: 'node14' }
: {
inject: ['src/ui/react-shim.ts'],
jsxFactory: 'h',
Expand Down

0 comments on commit 229dd7f

Please sign in to comment.