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
The goal of this file is to expose npx static commands to developers who install my package.
But when I replace #!/usr/bin/env -S npx ts-node-script by #!/usr/bin/env -S npx esbuild-runner, I then get this error when calling my npx static command :
(node:1888) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/jmarcou/dev/my-project/node_modules/static-html/bin/static.ts:2
import * as fs from 'fs';
^^^^^^
SyntaxError: Cannot use import statement outside a module
As if esbuild thinks I'm targeting ECMAScript Module instead of CommonJS.
I did create a esbuild-runner-config.js file, and tried to put it inside the root folder of the static-html package aswell as the bin folder, but nothing changed.
I'm trying to switch from
ts-node
toesbuild-runner
for my package https://github.com/Julien-Marcou/static-htmlHere is the problematic file bin/static.ts :
The goal of this file is to expose
npx static
commands to developers who install my package.But when I replace
#!/usr/bin/env -S npx ts-node-script
by#!/usr/bin/env -S npx esbuild-runner
, I then get this error when calling mynpx static
command :As if
esbuild
thinks I'm targetingECMAScript Module
instead ofCommonJS
.I did create a
esbuild-runner-config.js
file, and tried to put it inside the root folder of thestatic-html
package aswell as the bin folder, but nothing changed.Am I doing something wrong ?
The text was updated successfully, but these errors were encountered: