fresh icon indicating copy to clipboard operation
fresh copied to clipboard

Upgrading from 1.7.3 to 2.X was unsuccessful

Open chriswang- opened this issue 2 months ago • 4 comments

My experience upgrading from 1.7.3 to 2.X was unsuccessful. I followed the migration guide to upgrade my project to 2.X. The biggest problem was that VS Code could not properly configure launch.json. Even if the configuration seemed successful and the project started, I could not set breakpoints in the source code, which is unacceptable. Therefore, I rolled back. I hope there will be best practices and better documentation guidance.

I want to know if 2.X projects are still considered immature at this point.

For context, I am using Vite. I would like to know whether 2.X supports development workflows that do not use Vite.

chriswang- avatar Oct 02 '25 22:10 chriswang-

Can you please share what particularly did work with Fresh 1.7.3 and does not work anymore in Fresh 2?

How did you use VS Code's launch.json and how did setting breakpoints in Fresh 1 work for you, which does not work anymore in Fresh2?

I want to know if 2.X projects are still considered immature at this point.

Fresh 2 is still in the process of ironing out corner cases and compatibility with more strangely behaving packages in the npm registry, but it already can get used productively.

E.g. the Fresh website is a Fresh 2 app running on Deno Deploy. You can find the source code here -> https://github.com/denoland/fresh/tree/main/www

So I would not call Fresh 2 immature anymore. Aspiring teenager, maybe.

I would like to know whether 2.X supports development workflows that do not use Vite.

You can use the legacy Builder with Fresh 2 instead of using Vite for now, see here -> https://fresh.deno.dev/docs/advanced/builder

But it is unclear how long this will get supported.

fry69 avatar Oct 03 '25 08:10 fry69

Below is the simplest configuration and project. You can import it into VS Code and use the RUN & DEBUG tool to execute two DEBUG tasks: one for development and one for preview.

In development mode, after starting, it is not possible to set breakpoints on the source files in VS Code. In preview mode, the project crashes immediately after starting.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Fresh 2: Dev (Deno with Vite)",
            "type": "node",
            "request": "launch",
            "runtimeExecutable": "deno",
            "runtimeArgs": [
                "run",
                "--inspect-brk=127.0.0.1:9229",
                "-A",
                "--node-modules-dir",
                "npm:vite",
                "dev",
            ],
            "cwd": "${workspaceFolder}",
            "attachSimplePort": 9229,
            "outputCapture": "std",
        },
        {
            "name": "Fresh 2: Preview (Prod Build)",
            "type": "node",
            "request": "launch",
            "runtimeExecutable": "deno",
            "runtimeArgs": [
                "serve",
                "--inspect-brk=127.0.0.1:9229",
                "-A",
                "_fresh/server.js"
            ],
            "cwd": "${workspaceFolder}",
            "attachSimplePort": 9229,
            "outputCapture": "std"
        }
    ]
}

fresh-project.zip

chriswang- avatar Oct 03 '25 15:10 chriswang-

In development mode, I tried removing the IP configuration, and it seemed that breakpoints could be hit, but after refreshing the page a second time, they stopped working.

        {
            "name": "Fresh 2: Dev (Deno with Vite)",
            "type": "node",
            "request": "launch",
            "runtimeExecutable": "deno",
            "runtimeArgs": [
                "run",
                "--inspect-brk",
                "-A",
                "--node-modules-dir",
                "npm:vite",
                "dev",
            ],
            "cwd": "${workspaceFolder}",
            "attachSimplePort": 9229,
            "outputCapture": "std",
        },

chriswang- avatar Oct 03 '25 15:10 chriswang-

@fry69 Could you give me suggestion about issue? IF it is a bug or something wrong that I have to config

chriswang- avatar Oct 08 '25 14:10 chriswang-