babel-plugin-import-glob
babel-plugin-import-glob copied to clipboard
Win & Linux importing.
So on windows the importing looks like this if i have the following directory structure:
- source/
- app/
-controllers/
- a.js
- b.js
- c.js
import * as whatever from "app/**/*.js";
I receive an object that looks like this:
controllersa, controllersb, contorllersc ...
however on linux the output is
controllers$a, controllers$b, controllers$c, ...
I am not sure what is the reason behind this, but is there a way with your plugin to have the import mappings work such as
whatever.controllers.a
whatever.controllers.b
whatever.controllers.c
or something similar?
I receive an object that looks like this:
controllersa, controllersb, contorllersc ...
however on linux the output is
controllers$a, controllers$b, controllers$c, ...
I'd expect the behavior to be the same. We're not testing this on Windows though, so a good start would be to add AppVeyor. An example file is https://github.com/novemberborn/babel-plugin-files/blob/7803a37a7d094ab97c574570a697de1316c35c35/appveyor.yml.
s there a way with your plugin to have the import mappings work such as
whatever.controllers.a whatever.controllers.b whatever.controllers.c
or something similar?
The idea is that you should be able to import a specific file (import {controllers$a} from 'app/**/*.js'
). Creating a nested object structure goes counter to that.
It's an interesting thought though. @lukescott what do you think?
It's unfortunate travis doesn't have Windows support. Adding Appveyor wouldn't hurt. I suspect it has something to do with \
vs /
, although we use path.sep
, so it's quite odd that $
is missing.
Nested objects: I typically avoid paths that give me $
anyway, so I don't have a preference on it. It could be an option. In fact it may even be easier to work with anyway. Gives you an option to target a specific folder. Generating the structure may be a bit tricky though.
Path sep is quite works odd on windows in my experience altought unix style path separators work just fine on windows.
I am using this module to load all my angular controllers into one file such as
Controllers/user/ profile.js Password.js Search.js Etc..
So it generates bice controller names: UserProfile.js however on linux i got User$Profile and had no idea whats causing the issue. Anyways a quick replace solved temporary but i think it shouls be fixed somewhere in the code or dependencies also would be really cool if we couls get a pretty directory structure object out from this plugin. (I just loved it how nicely its done and working :))