Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Conversation

dphang
Copy link
Collaborator

@dphang dphang commented Oct 8, 2020

By default handlers are not minified, but with minifyHandlers we can use the minified versions of handlers (pre-built into the package, so it won't add any time to the deployment), which reduces handler from 500 kB to 200 kB. It may also improve performance slightly.

Tests

Added tests, also manually tested on e2e test app.

@dphang dphang linked an issue Oct 8, 2020 that may be closed by this pull request
@@ -20,221 +24,280 @@ describe("Builder Tests", () => {
const fixturePath = join(__dirname, "./simple-app-fixture");
const outputDir = join(fixturePath, ".test_sls_next_output");

beforeEach(async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original tests are not changed, not sure why git diff is this way

regex: expect.any(String)
}

it("default handler is not minified", async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New test

"index.js"
]);
expect(customerPages).toEqual(["[...catchAll].js", "[post].js"]);
it("API handler is not minified", async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New test

describe("API Handler Artefact Files", () => {
it("copies build files", async () => {
expect.assertions(2);
describe("Minified handlers build", () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New test

@dphang dphang merged commit 1b33e72 into master Oct 9, 2020
@delete-merged-branch delete-merged-branch bot deleted the dphang/minify-handlers branch October 9, 2020 05:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider using Rollup.js Terser plugin to provide minified handlers
1 participant