DDP is not defined

Hello, i think there is a major problem on last release (v1.8.0.1).

  1. Let’s see what i have done :
    meteor create Playground --release 1.8

Then server\main.js :

import { Meteor } from 'meteor/meteor';

Meteor.startup(() => {
  // code to run on server at startup

Worker = DDP.connect('localhost:3010');

It seems to work because i got this and i have nothing else running :

I20181209-16:37:36.244(1)? stream error Network error: ws://localhost:3010/websocket: connect ECONNREFUSED
  1. If you use the same code but create your app in like this :
    meteor create Playground

You will get this error :

W20181209-16:40:15.297(1)? (STDERR) C:\Users\XXXX\AppData\Local\.meteor\packages\meteor-tool\1.8.0_1\mt-os.windows.x86_64\dev_bundle\server-lib\node_modules\fibers\future.js:280
W20181209-16:40:15.298(1)? (STDERR)                                             throw(ex);
W20181209-16:40:15.298(1)? (STDERR)                                             ^
W20181209-16:40:15.298(1)? (STDERR)
W20181209-16:40:15.299(1)? (STDERR) ReferenceError: DDP is not defined
W20181209-16:40:15.299(1)? (STDERR)     at main.js (server/main.js:53:1)
W20181209-16:40:15.300(1)? (STDERR)     at fileEvaluate (packages\modules-runtime.js:336:7)
W20181209-16:40:15.300(1)? (STDERR)     at Module.require (packages\modules-runtime.js:238:14)
W20181209-16:40:15.300(1)? (STDERR)     at require (packages\modules-runtime.js:258:21)

What is going on guys ?

You need to import DDP client as a dependency:

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

const Worker = DDP.connect('localhost:3010');

Ok thanks, but why it’s working without import in 1.8 ? is a minor version …

No clue actually. I do know that versions prior to 1.3 did not require it

The import isn’t necessary in either, so no idea what happened to you

Here’s the latest version of ddp-client showing where it exports DDP as a global variable