You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, pro-js team, hope you are doing well,
It is good that you are writing such a good lib, but you are making serious mistakes of the node module resolution. Here is the thing, when you have a project and you wrote all of the code with ESNEXT (ES6+) and you expect your code should work, but node requires from you what, require() resolving of modules.
What you should do, you can migrate to typescript and write exact good tsconfig for you lib and using Makefile commands such as $(OUT_DIR)/node_modules: mkdir -p $@ ln -s ../lib $@/lib you can create node_modules folder inside of your dist | build folder and then put aliases of your lib folder to node_modules, so each require() will search for nearest node_modules.
NOTE: This type of config is used when your tsconfig has path aliases. The example, you say for every './lib/' should be replaced by 'lib' and when you build this lib stays by not changing it to the previous state as './lib/', cause of that require('lib') searches from nearest node_modules lib. If you are not using the path, then you don't need Makefile config, just write your lib with TS and build it.
Also, you can achieve the same result with webpack.
I hope, I helped you with something.
The text was updated successfully, but these errors were encountered:
@fayzzzm Hi, thanks for your opinion. We try to support ES6+ & Typescript in our library. As soon as, we publish our next version with this & some special methods. :)
Hey, pro-js team, hope you are doing well,
It is good that you are writing such a good lib, but you are making serious mistakes of the node module resolution. Here is the thing, when you have a project and you wrote all of the code with ESNEXT (ES6+) and you expect your code should work, but node requires from you what,
require()
resolving of modules.What you should do, you can migrate to typescript and write exact good tsconfig for you lib and using Makefile commands such as
$(OUT_DIR)/node_modules: mkdir -p $@ ln -s ../lib $@/lib
you can create node_modules folder inside of your dist | build folder and then put aliases of your lib folder to node_modules, so eachrequire()
will search for nearest node_modules.NOTE: This type of config is used when your tsconfig has path aliases. The example, you say for every './lib/' should be replaced by 'lib' and when you build this lib stays by not changing it to the previous state as './lib/', cause of that require('lib') searches from nearest node_modules lib. If you are not using the path, then you don't need Makefile config, just write your lib with TS and build it.
Also, you can achieve the same result with webpack.
I hope, I helped you with something.
The text was updated successfully, but these errors were encountered: