Closed Devric closed 8 years ago
Have you tried to set up module-alias programmatically, or you just use package.json as a place to store aliases? I'm not sure whether babel-cli uses some custom way to require
modules but if not then the setup should be pretty much the same
tried both aint working, babel seems to have resolve config similar to webpack. i'll see if it shares similar mechanism
I guess it shoud be fixed now. Is there any way you could check it again?
I'm closing this since no response
I still got the issue. When I transpile it with babel into another directory the require statement aims to my untranspiled code.
src/index.js (original)
import a from '@b'
This resolves to src/
instead of dist/src
:
dist/src/index (transpiled)
var a = require('@b')
@ndabAP You need to configure your aliases relative to the directory, like moduleAlias.addAlias('@b', __dirname + '/b')
so it will look deeper in the current directory only
Any chance this works with babel-cli?
i basically converts to es5 from babel-cli than run normal node server on the compiled code.