0

I'm trying to connect my meteor app running on localhost:4000 to the server of another meteor app running on localhost:3000;

reading the docs, I'm trying to do

import { DDP } from 'meteor/ddp-client'

As soon as I add this import, the app starts crashing with this error: [vite] (client) Pre-transform error: Failed to resolve import "../common/namespace.js" from "meteor/ddp-client". Does the file exist?

my vite.config.js:

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { meteor } from "meteor-vite/plugin";

export default defineConfig({
  plugins: [
    meteor({
      clientEntry: "imports/ui/main.js",
      serverEntry: "server/main.js",
      enableExperimentalFeatures: true,
      stubValidation: {
        ignorePackages: ["meteor/mongo"],
      },
    }),
    vue(),
  ],
  optimizeDeps: {
    exclude: ["vue-meteor-tracker"],
  },
});

my package.json:

...
"dependencies": {
    "@babel/runtime": "^7.23.5",
    "@tailwindcss/postcss": "^4.1.10",
    "@vueuse/core": "^13.5.0",
    "bcrypt": "^6.0.0",
    "flyonui": "^2.2.0",
    "meteor-node-stubs": "^1.2.7",
    "notyf": "^3.10.0",
    "postcss-load-config": "^6.0.1",
    "tailwindcss": "^4.1.10",
    "tailwindcss-motion": "^1.1.1",
    "vue": "^3.5.17",
    "vue-router": "^4.2.5"
  },
  "meteor": {
    "modern": true,
    "mainModule": {
      "client": "client/entry-meteor.js",
      "server": "server/entry-meteor.js"
    },
    "testModule": "tests/main.js"
  },
  "devDependencies": {
    "@faker-js/faker": "^9.9.0",
    "@iconify-json/tabler": "^1.2.19",
    "@iconify/tailwind4": "^1.0.6",
    "@vitejs/plugin-vue": "^5.2.1",
    "autoprefixer": "^10.4.16",
    "meteor-vite": "^3.2.1",
    "postcss": "^8.5.6",
    "prettier": "^3.5.3",
    "prettier-plugin-tailwindcss": "^0.6.13",
    "vite": "^6.0.11"
  }

I'm using jorgenvatle:[email protected]

1 Answer 1

0

This seems to be a bug with the vite package not correctly covering export. Currently in the ddp-client package the server/server.js contains the following code:

export { DDP } from '../common/namespace.js';

Your can for now fix this locally by creating a packages folder and copy the ddp-client folder as it is into packages and change server/server.js to the followng:

import { DDP } from '../common/namespace.js';

export { DDP };
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.