Importing node modules from root directory using es6 and babel-node

前端 未结 3 1661
[愿得一人]
[愿得一人] 2020-12-13 23:57

I\'m writing a node app with es6 using babel transpiler.

I have 2 files index.js & my-module.js on my root directory

-          


        
3条回答
  •  余生分开走
    2020-12-14 00:31

    The solution from FakeRainBrigand/Gavriguy is good and works well. So i decided to develop a plugin which you can easily install with npm in and use a simple Babel-Plugin.

    https://github.com/michaelzoidl/babel-root-import

    Hope this helps...

提交回复
热议问题