> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://akamai.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://akamai.ferndocs.com/_mcp/server.

# Import a JavaScript module

EdgeWorkers are compiled as ECMAScript 6 Modules, and provide access to static import. You can load relative JavaScript modules in the main.js file that contain the callbacks used to modify HTTP requests and responses.

> 📘 The JavaScript module name you import needs to include the `.js` extension.

```javascript
import { square, diag } from 'utils/lib.js';
export function onClientResponse(request) {
  response.setHeader('X-Square', square(11));
  response.setHeader('X-Diag', diag(4, 3));
}
```

If you use the import function you can load additional module files and directories in the EdgeWorkers code bundle. Use the following structure for the EdgeWorkers code bundle.

```javascript
|-- bundle.json
|-- main.js
|-- utils
     |-- lib.js

//------ lib.js ------
export const sqrt = Math.sqrt;
export function square(x) {
    return x * x;
}
export function diag(x, y) {
    return sqrt(square(x) + square(y));
}
```