-
Notifications
You must be signed in to change notification settings - Fork 71
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
Module is not transpiled into ES5? #168
Comments
That is correct. The module build target is ES2018 (so, even newer than es6). I don't know what CRA is, so it would be helpful to know which is the maximum version that your system supports. git clone git@github.com:decentralized-identity/did-jwt.git
cd did-jwt
nano tsconfig.json # edit tsconfig.json#L4 and set the desired `target`
yarn install
yarn build
yarn link
# now the local did-jwt is ready to be used instead of the one from npmjs
cd path/to/your/project
yarn link did-jwt
yarn install
# now your project is using the locally built version of did-jwt
yarn build/test/etc... # run your tests to see which version works Please try this and report back |
CRA stands for create-react-app. It is a automated boilerplate for react apps that comes with a preconfigured tool chain. I just did the commands you gave above, but did not edit the target, it is still ES2018, but I restarted my app and it works now. I don't know what the last command does, so I didn't run that. However, now I have both npm and yarn in my project, is this a problem? Also, just curious, why does this work and what's going on behind the scenes here? |
The first It's usually not ok to hold both My instructions from earlier should also work with git clone git@github.com:decentralized-identity/did-jwt.git
cd did-jwt
nano tsconfig.json # edit tsconfig.json#L4 and set the desired `target`
npm install
npm run build
npm link
# now the local did-jwt is ready to be used instead of the one from npmjs
cd path/to/your/project
npm link did-jwt
npm install
# now your project is using the locally built version of did-jwt
npm run build/test/etc... # run your tests to see which version works We prefer yarn because it is usually faster and causes fewer issues with node-gyp. That being said, I'm surprised that the local install works while the official install doesn't. This makes me think it may have been just a temporary issue. Can you try to do a clean install using just yarn? cd /path/to/your/project
yarn unlink did-jwt
rm -rf node_modules
yarn install |
This seemed to work for me. Any idea why I was getting the error previously? Also, I removed package-lock.json. What do you mean by thsi line: "Also, these changes are only specific to your local machine. Everywhere else, yarn will use the version declared in package.json and resolve dependencies from npmjs."? Thanks! |
I'm not sure why the errors appeared previously. The stack of tools required to build an app is pretty high, and experience tells us that sometimes things step out of alignment. In these cases, it's best to clear the table and start fresh (remove node_modules, cleare caches, restart the machine, grab a coffe, etc). It's not a fault of this project or yours. I meant that linking is only specific to your computer. I'm closing this now, please reopen if there's work still needed here. |
The error has returned! I tried redoing the commands I did before as shown above a couple times, but this time it is persisting. I am not using this package directly, but rather it is a dependency of another package I'm using |
I got this error during build time using CRA:
I started looking into JS toolchains, babel, and webpack, since that seemed to be the problem. I've always relied of CRA's default toolchain so I've never really messed with these things. From my understanding from my research, there is a default rule in that CRA includes in it's webpack config file, that excludes transpiling the node_modules directory, as this would significantly slow down the build time. Usually this is fine, since the dependencies have already been transpiled from ES6 to ES5.
However, I am guessing that this module, did-jwt, has not been transpiled from ES6 to ES5, and thus causes this error. Can anyone confirm if this is correct? And does anyone know any solutions to this problem?
The text was updated successfully, but these errors were encountered: