analog icon indicating copy to clipboard operation
analog copied to clipboard

AnalogJS 1.0 migration guide

Open brandonroberts opened this issue 1 year ago • 5 comments

In the 1.0 release, the Analog Vite plugins will be published as ESM-only.

Package updates Update vite to ^5.0.0 in the root package.json and install if on a 4.x release version

For existing Angular CLI workspaces, a few migrations will need to be made.

  • Add "type": "module" to the root package.json
  • Rename any .js files to .cjs, such as tailwind.config.js and postcss.config.js
  • Update any builders that were previously using @nx/vite to use @analogjs/platform equivalents.
    • @nx/vite:build -> @analogjs/platform:vite
    • @nx/vite:dev-server -> @analogjs/platform:vite-dev-server
    • @nx/vite:test -> @analogjs/platform:vitest
  • Update the root property in the angular.json to be "." instead of ""

For existing Nx workspaces with an Analog project

  • Add a package.json in the project root that includes { "type": "module" } so Vite resolves it as ESM
  • In the vite.config.ts, add a config for file serving to the server configuration
export default defineConfig(({ mode }) => {
  return {
    // other config
    server: {
      fs: {
        allow: ['.'],
      },
    },
});

brandonroberts avatar Dec 19 '23 19:12 brandonroberts

the 1.0 release doesn't have @analogjs/trpc package.

@brandonroberts mentioned that trpc support will be moved to @spartan-ng/trpc that is maintained by @goetzrobin

currently @spartan-ng/trpc doesn't have any releases and i'm keeping @analogjs/trpc at 0.2.45 in my project for now.

is this the right way to go?

nckirik avatar Mar 24 '24 16:03 nckirik

@nckirik yes, that's correct. It should still work the same as before as an independent package

brandonroberts avatar Mar 24 '24 19:03 brandonroberts

Just to note, I needed to also update my vite to version 5 (it was 4 and was throwing the ESM error)

BaronVonPerko avatar Mar 28 '24 19:03 BaronVonPerko

Good catch. Thanks @BaronVonPerko

brandonroberts avatar Mar 28 '24 20:03 brandonroberts

@brandonroberts I can look into this.

sonukapoor avatar Sep 21 '24 23:09 sonukapoor