Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support esbuild config #109

Merged
merged 7 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export default {
sourceRewriteMatch: "",
firebaseJson: "",
cloudRunBuildDir: "",
esbuildBuildOptions: (defaultOptions: BuildOptions) => Promise<BuildOptions> | BuildOptions,
}),
target: "#svelte",
},
Expand Down Expand Up @@ -459,6 +460,47 @@ export default {

</details>

<details>
<summary><code>esbuildBuildOptions</code></summary>

As an escape hatch, you may optionally specify a function which will receive the final esbuild options generated by this adapter and returns a modified esbuild configuration. The result of this function will be passed as-is to esbuild. The function can be async.

For example, you may wish to add a plugin:

```js
import firebase from "svelte-adapter-firebase";

/** @type {import('@sveltejs/kit').Config} */
export default {
kit: {
adapter: firebase({
esbuildBuildOptions(defaultOptions) {
return {
...defaultOptions,
plugins: []
}
}
}),
target: "#svelte",
},
};
```

The default options for this version are as follows:

```js
{
entryPoints: ['.svelte-kit/firebase/handler.js'],
outfile: `pathToOutputDir/index.js`,
bundle: true,
inject: ['pathTo/shims.js'],
platform: 'node'
}
```

</details>


## Cloud Function

With this `firebase.json` and `functions/` dir in a standard SvelteKit app structure and default `svelte-adapter-firebase` config:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@sveltejs/kit": "^1.0.0-next.110",
"@sveltejs/kit": "1.0.0-next.132",
"@types/express": "^4.17.12",
"@types/node": "^14.14.35",
"ava": "^3.15.0",
"firebase-functions": "^3.14.1",
"husky": "^5.0.8",
"typescript": "^4.2.3",
"xo": "^0.40.1"
"xo": "^0.40.3"
},
"scripts": {
"prepare": "husky install",
Expand Down
Loading