Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnalogJS 1.0 migration guide #809

Open
brandonroberts opened this issue Dec 19, 2023 · 5 comments
Open

AnalogJS 1.0 migration guide #809

brandonroberts opened this issue Dec 19, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@brandonroberts
Copy link
Member

brandonroberts commented Dec 19, 2023

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 brandonroberts added the enhancement New feature or request label Dec 19, 2023
@brandonroberts brandonroberts changed the title Add migration for ESM support to Angular CLI/Nx workspaces [1.x] AnalogJS 1.0 migration guide Mar 14, 2024
@brandonroberts brandonroberts pinned this issue Mar 14, 2024
@nckirik
Copy link
Contributor

nckirik commented Mar 24, 2024

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?

@brandonroberts
Copy link
Member Author

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

@BaronVonPerko
Copy link
Contributor

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

@brandonroberts
Copy link
Member Author

Good catch. Thanks @BaronVonPerko

@sonukapoor
Copy link
Contributor

@brandonroberts I can look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants