Closed Tei1988 closed 2 years ago
Thanks for using this plugin and contribution!
Does it work if use import GasPlugin from 'esbuild-gas-plugin
instead of import { GasPlugin } from 'esbuild-gas-plugin
?
// index.ts
import GasPlugin from 'esbuild-gas-plugin'
console.log(GasPlugin)
> tsc && node dist/index.js
{ GasPlugin: { name: 'gas-plugin', setup: [Function: setup] } }
my tsconfig.json
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"rootDir": "./src/",
"outDir": "./dist/",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}
Thank you for reply.
Does it work if use import GasPlugin from 'esbuild-gas-plugin instead of import { GasPlugin } from 'esbuild-gas-plugin ?
No, it does not work.
I tried to build using this script below:
import * as esbuild from 'esbuild'
import GasPlugin from 'esbuild-gas-plugin'
esbuild.build({
entryPoints: ['src/main.ts'],
bundle: true,
outfile: 'dist/Code.gs',
plugins: [GasPlugin]
})
and got this output below:
$ ts-node ./esbuild.ts
/src/node_modules/ts-node/src/index.ts:820
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
esbuild.ts:8:13 - error TS2769: No overload matches this call.
The last overload gave the following error.
Type 'typeof import("/src/node_modules/esbuild-gas-plugin/dist/index")' is missing the following properties from type 'Plugin': name, setup
8 plugins: [GasPlugin]
...
This error seems that the type of GasPlugin is missing.
By the way, I found that my change is wrong becasuse of the compiled javascript is not work. So I will close this PR.
I supposed that using export = { GasPlugin }
instead of exports.GasPlugin = GasPlugin
will resolve this situation.
Could I send new PR?
Hello.
When I have written an esbuild configuration in TypeScript, I could not import { GasPlugin } from esbuild-gas-plugin package because of no types exported in dist/index.d.ts. So I add export keyword to GasPlugin.
In my local machine, it seems to work.
Anyway, thank you for publish this plugin.