Giter Club home page Giter Club logo

Comments (6)

shlroland avatar shlroland commented on August 15, 2024

@thekip

from js-lingui.

thekip avatar thekip commented on August 15, 2024

Sorry, i could not debug code for you. Did you check that version of SWC core is compatible with version of lingui swc plugin? What is the error message?

from js-lingui.

shlroland avatar shlroland commented on August 15, 2024

Sorry, i could not debug code for you. Did you check that version of SWC core is compatible with version of lingui swc plugin? What is the error message?

image
// package.json

{
  "name": "lingui-test",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "@lingui/macro": "^4.11.2",
    "@lingui/react": "^4.11.2",
    "react": "^18.3.1",
    "react-dom": "^18.3.1"
  },
  "devDependencies": {
    "@lingui/cli": "^4.11.2",
    "@lingui/swc-plugin": "^4.0.8",
    "@lingui/vite-plugin": "^4.11.2",
    "@swc/core": "^1.7.4",
    "@types/react": "^18.3.3",
    "@types/react-dom": "^18.3.0",
    "@typescript-eslint/eslint-plugin": "^7.15.0",
    "@typescript-eslint/parser": "^7.15.0",
    "@vitejs/plugin-react-swc": "^3.5.0",
    "eslint": "^8.57.0",
    "eslint-plugin-react-hooks": "^4.6.2",
    "eslint-plugin-react-refresh": "^0.4.7",
    "typescript": "^5.2.2",
    "vite": "^5.3.5"
  }
}

// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { lingui } from "@lingui/vite-plugin";


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react({
      plugins: [['@lingui/swc-plugin', {}]],
    }),
    lingui(),
  ],
})

from js-lingui.

thekip avatar thekip commented on August 15, 2024

You have incompatibility between swc-core and lingui swc plugin. Please remove ^ from @swc/core and @lingui/swc-plugin.

Also check compatibility table

from js-lingui.

thekip avatar thekip commented on August 15, 2024

Also this explcitly stated in the vite-swc example readme https://github.com/lingui/js-lingui/tree/main/examples/vite-project-react-swc#example-project-using-vite--swc-compiler-with-linguijs-plugin

and specific version of @swc/core fixed used resolutions field, as well as @lingui/swc-plugin specified without a caret symbol.

from js-lingui.

basaran avatar basaran commented on August 15, 2024

I had the same problem, did a pnpm update and swc that came with the @vitejs/plugin-react-swc got updated to 1.7 behind the scenes and lingui started failing. I checked from the history that the previous version was 1.6.5.

I added the following key to package.json:

    "resolutions": {
        "@swc/core": "~1.6.5"
    },

cleared node_modules, and .swc and executed a clean install. Now it's working and swc/core is set to 1.6.13.

P.S I couldn't make heads or tails of the compatibility matrix. It's a bit late here.

from js-lingui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.