From 51ef0c61c38e4d0a44e1946104eba40e67587ea2 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Mon, 11 Sep 2023 11:11:57 -0700 Subject: [PATCH] Fix code splitting docs Some of the examples were incorrect. --- app/views/docs/functions-develop.phtml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/views/docs/functions-develop.phtml b/app/views/docs/functions-develop.phtml index 2f366cfc..b1d11293 100644 --- a/app/views/docs/functions-develop.phtml +++ b/app/views/docs/functions-develop.phtml @@ -2423,16 +2423,18 @@ export default function ({ res }) {
  • PHP

    -
    // src/utils.php
    +                
    <?php
    +// src/utils.php
     
     function add($a, $b) {
         return $a + $b;
     }
    -
    // src/main.php
    +                
    <?php
    +// src/main.php
     
    -include 'utils.php';
    +require_once(__DIR__ . '/utils.php');
     
     return function ($context) {
         return $context->res->send(add(1, 2));
    @@ -2442,14 +2444,14 @@ return function ($context) {
             
  • Python

    -
    // src/utils.py
    +                
    # src/utils.py
     
     def add(a, b):
    -    return a + b;
    +    return a + b
             
    -
    // src/main.py
    +                
    # src/main.py
     
     from .utils import add
     
    @@ -2508,6 +2510,8 @@ int add(int a, int b) {
                     
    // lib/main.dart
     import 'dart:async';
     
    +import 'package:package_name/utils.dart';
    +
     Future<dynamic> main(final context) async {
         return context.res.send(add(1, 2));
     }