standard-things / esm

Tomorrow's ECMAScript modules today!
Other
5.26k stars 146 forks source link

Is there any docs on how to build esm? #841

Open svankirk opened 4 years ago

svankirk commented 4 years ago

I'm new to github and contributing to projects here. I'm interested in digging into this project to understand why there are problems with Reflect. After I've downloaded it, how to I compile esm to create a non-webpacked version of esm?

Any help is much appreciated.

jdalton commented 4 years ago

Hi @svankirk!

Did you figure it out?

svankirk commented 4 years ago

Actually no. I thought I had, but now I don't think so. I cloned esm onto my desktop and then ran npm init to get the node_modules and finally tried to build the project. I ran several scripts:

    "prepare": "npm run build:prod",
    "prepub": "npm run test:prod && npm run build:prod",
    "build": "node script/build.js",
    "build:prod": "npm run build -- --prod",
    "pub": "node script/publish.js",
    "test:prod": "node script/test.js --prod"

Unfortunately, none of these end up reproducing the esm.js I get when I just use npm install esm in my other project. The newly created esm.js causes errors in which it is looking for the undefined global variable.

My goal is to try and figure out why Reflect.getMetadata("design: type", ReflectTest.prototype, "propString") doesn't seem to be working for ta-json. I don't know if the problem is related to esm or not, but I get this error which pops up in the esm.js editor window:

Exception has occurred: TypeError
F:\dev\javascript\words\server\wordLobby.ts:1
TypeError: _7f5‍.g.Reflect.getMetadata is not a function
    at Object.<anonymous> (f:\dev\javascript\words\server\wordLobby.ts:849:21)
    at Generator.next (<anonymous>)