deckchairlabs / mesozoic

A generic build system for Deno web apps
https://deno.land/x/mesozoic
MIT License
30 stars 2 forks source link

Add root alias to fixture #17

Open d9k opened 11 months ago

d9k commented 11 months ago

Using root alias with Ultra build which uses mesozoic causes problems: `/\~/` alias + build => Module not found on runtime | issue #290 | ultra: entries for paths with aliases not created in .ultra/importMap.browser.json and importMap.server.json at all!

Please add root alias to fixture and resolve build errors.

For example:

importMap.json:

{
  "imports": {
       "/~/": "/src/",
   }
}

client.tsx, server.tsx:

replace

import App from "./src/app.tsx" with import App from "/~/app.tsx".

d9k commented 10 months ago

If add alias as describe above deno task test fails with:

error: AssertionError: Snapshot does not match:

    [Diff] Actual / Expected

    {                                                                                        
      imports: {                                                                             
+       "./client.tsx": "/client.0774b963.js",             
+       "./src/app.tsx": "/src/app.4051f35a.js",     
+       "./src/components/Test.tsx": "/src/components/Test.d8e044d9.js",                     
-       "./client.tsx": "/client.eaebf466.js", 
        "https://deno.land/": "https://deno.land/",                                          
        "https://esm.sh/": "https://esm.sh/",
        "react-dom/client": "https://esm.sh/v127/react-dom@18.2.0/es2022/client.js",         
        "react/jsx-runtime": "https://esm.sh/stable/react@18.2.0/es2022/jsx-runtime.js",
+       "ultra/hooks/use-asset.js": "https://deno.land/x/ultra@v2.2.1/hooks/use-asset.js", 
        "ultra/hydrate.js": "https://deno.land/x/ultra@v2.2.1/hydrate.js",   
        react: "https://esm.sh/stable/react@18.2.0/es2022/react.mjs",       
+       twind: "https://esm.sh/v127/twind@0.16.17/es2022/twind.mjs",
      },       
      scopes: {                               
        "https://deno.land/": {                                                              
          "/x/": "https://deno.land/x/",
        },                                    
        "https://esm.sh/": {                                                                 
          "/stable/": "https://esm.sh/stable/",    
          "/v127/": "https://esm.sh/v127/",
        },
      },
    }

As you see, "./src/app.tsx": "/src/app.4051f35a.js" disappears from imports