Comments (7)
My solution is to replace @nx/esbuild:esbuild with
the @nx/webpack:webpack
and configure correctly the web pack config.
from nx-firebase.
We also solved it by using webpack instead of esbuild
This was some time ago so i am not 100% sure this config works today.
but in the project.json
file set the targets.build
to
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"target": "node",
"compiler": "tsc",
"outputPath": "dist/apps/<APP_NAME>",
"main": "apps/<APP_NAME>/src/main.ts",
"tsConfig": "apps/<APP_NAME>/tsconfig.app.json",
"assets": [
"apps/<APP_NAME>/src/assets",
{
"glob": "**/*",
"input": "apps/firebase/environment",
"output": "."
}
],
"isolatedConfig": true,
"webpackConfig": "apps/<APP_NAME>/webpack.config.js",
"generatePackageJson": true
},
"configurations": {
"development": {},
"production": {}
}
},
And the webpack.config.js
looks like
const { composePlugins, withNx } = require('@nx/webpack')
// Nx plugins for webpack.
module.exports = composePlugins(withNx(), config => {
// Update the webpack config as needed here.
// e.g. `config.plugins.push(new MyPlugin())`
return config
})
from nx-firebase.
That's interesting to know @chrisDupuis thanks.
Yes, the plugin's use of esbuild
for bundling functions is just one option. Webpack or rollup are also possible, just with the necessary changes to project.json
for your functions.
from nx-firebase.
I would be interested in any links you might have for how esbuild
might not be compatible with NestJs.
from nx-firebase.
Ah, just done a little research and I understand the issue now - esbuild
by design does not handle typescript decorators. That is not great news and I didnt know this about esbuild.
Someone here is talking about using an esbuild plugin to pre-compile typescript before esbuild gets it.
https://hackernoon.com/using-typescript-decorators-with-esbuild
from nx-firebase.
Thanks @Gurey
I think at some point I'll look into making the choice of bundler an option for functions.
from nx-firebase.
As mentioned in the article I linked above, this esbuild plugin seems to be the way to go for decorators with esbuild.
https://github.com/thomaschaaf/esbuild-plugin-tsc
Would require an esbuild config for function projects that use decorators, so if anyone is able to experiment with this and share their solution that would be great.
https://nx.dev/nx-api/esbuild/executors/esbuild#esbuildconfig
from nx-firebase.
Related Issues (20)
- Cleanup of unneeded files? HOT 2
- Functions generator always uses @nx/node@16 even if the workspace version is newer HOT 1
- Nx 18, 'project crystal' and Inferred Tasks HOT 4
- Confusing functions deploy error when switching to pnpm, might be exposing a package.json bug HOT 2
- Use dependabot to keep firebase SDK versions upto date
- Migrate plugin project to `pnpm` for faster e2e/compat tests
- Add feature to update node targets in a workspace
- Firebase functions & `pnpm` support HOT 1
- Derive dependency versions from the workspace plugin `package.json`
- Use firebase SDK template in the init generator HOT 1
- Bump plugin to Nx 17.x (2.4.0 release)
- Release v2.3.0 plan HOT 1
- Dependabot PR's dont run `postinstall` script
- Change e2e tests to be `as-provided` rather than `derived` for future proofing
- Documentation tasks
- Help needed upgrading from v1 HOT 2
- Deleting a function project using file system leaves implicitDependency in firebase app HOT 1
- The path to emulator export/import dir is incorrect
- Nx 17+ terminates tasks with `ELIFECYCLE Command failed with exit code 128.` HOT 1
- Deploy only changed Functions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nx-firebase.