You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled upon an issue with a custom tsconfig.json.
When you use a custom tsconfig, ESBuild seems to prioritize node_modules over tsconfig.json’s paths (which means you can’t overwrite any installed dependencies). This is not an issue when the tsconfig.json file is automatically detected.
The linaria package should’ve been replaced with ./linaria-mock.ts. So the generated bundle should print 5:
$ node out.js
5
Actual result
The linaria package is used as-is, despite the paths section in tsconfig. Therefore, the generated bundle throws a Linaria error:
$ node out.js
/tmp/esbuild-bug-test/out.js:32
throw new Error('Using the "css" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly.');
^
Error: Using the "css" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly.
at Object.css2 (/tmp/esbuild-bug-test/out.js:32:11)
at Object.<anonymous> (/tmp/esbuild-bug-test/out.js:58:27)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Further notes
The issue disappears if you use an automatically inferred tsconfig.json file:
# Note: no --tsconfig=tsconfig.json flag
$ yarn esbuild --bundle index.ts --outfile=out.js --platform=node
$ node out.js
5
The issue disappears if you remove the linaria dependency:
Hey,
I stumbled upon an issue with a custom
tsconfig.json
.When you use a custom tsconfig, ESBuild seems to prioritize
node_modules
overtsconfig.json
’spaths
(which means you can’t overwrite any installed dependencies). This is not an issue when thetsconfig.json
file is automatically detected.Repro
1. Create the test project:
2. Run ESBuild with the
--tsconfig
flag:3. Try to run the generated bundle:
Expected result
The
linaria
package should’ve been replaced with./linaria-mock.ts
. So the generated bundle should print5
:Actual result
The
linaria
package is used as-is, despite thepaths
section intsconfig
. Therefore, the generated bundle throws a Linaria error:Further notes
The issue disappears if you use an automatically inferred
tsconfig.json
file:# Note: no --tsconfig=tsconfig.json flag $ yarn esbuild --bundle index.ts --outfile=out.js --platform=node $ node out.js 5
The issue disappears if you remove the
linaria
dependency:In this case, the overwrite happens as expected.
The text was updated successfully, but these errors were encountered: