Comment on page
Build commands
These commands will allow you to generate the code that can be used to run or analyze a Frontity project
You'll get something similar to this:
├── build
│ ├── analyze
│ │ ├── module-development.html
│ │ └── server-development.html
│ ├── bundling
│ │ ├── chunks.module.json
│ │ └── entry-points
│ │ ├── server.ts
│ │ └── my-frontity-project
│ │ └── client.ts
│ ├── server.js
│ └── static
...
│ ├── xxxxx1.module.js
│ ├── xxxxx2.module.js
The most important file for deployments in any hosting is
server.js
, which is actually a middleware that can be inserted in a custom web server.So, easy way of executing a Frontity project in any Node.js server:
- Launch remotely
npx frontity build
to generate thebuild
folder. - Launch remotely
npx frontity serve
to launch a web server that makes use of theserver.js
generated in the previous step.
// lambda.js
const awsServerlessExpress = require("aws-serverless-express");
const app = require("./build/server.js").default;
const server = awsServerlessExpress.createServer(app);
exports.handler = (event, context) => {
awsServerlessExpress.proxy(server, event, context);
};
When doing
npx frontity build
you get a build
folder in the root of your project.├── build
│ ├── analyze
│ │ ├── module-development.html
│ │ └── server-development.html
│ ├── bundling
│ │ ├── chunks.module.json
│ │ └── entry-points
│ │ ├── my-frontity-project
│ │ │ └── client.ts
│ │ └── server.ts
│ ├── server.js
│ └── static
│ ├── my-frontity-project.module.js
│ └── list.module.js
Inside that
build
folder there is a .html
file generated at analyze/module-development.html
. This file is a visual report in the form of a tree generated by Webpack Bundle Analyzer.
This report shows you the modules included on each bundle and the size of each one, so that you can analyze them and maybe decide using other modules (or not including a specific module at all) to reduce the size of the final bundle.
Last modified 2yr ago