require.extensions getting deprecated?

324 views
Skip to first unread message

Asyraf Abdul Rahman

unread,
May 5, 2014, 6:13:38 AM5/5/14
to mea...@googlegroups.com
I was going through your code and saw these particular lines:

    /**
     * Add our server node extensions
     */
    require.extensions['.server.controller.js'] = require.extensions['.js'];
    require.extensions['.server.model.js'] = require.extensions['.js'];
    require.extensions['.server.routes.js'] = require.extensions['.js'];

I went to the node page to check what require.extensions was all about, and found out that this method will be deprecated:


may I suggest we rethink the naming conventions for the server/client files? something that doesn't involve dots perhaps? maybe

articlescontroller-server.js
articlescontroller-client.js

I feel it saves us from some upgrade issues with node in the future (although I'm running 0.11 and dont seem to face any issues yet).

Also, would love to contribute in any way, let me know how. Thanks! 

Amos Haviv

unread,
May 5, 2014, 9:29:17 AM5/5/14
to mea...@googlegroups.com
Hi Asyraf,

It was a though choice, usually we don't go with deprecated features, but i dug up a little and discovered they can't really remove this feature without breaking many modules: 

"Since the Module system is locked, this feature will probably never go away."

So after testing it on 0.11 we decided to take that little risk in favour of project simplicity. We would watch Node versions carefully to see if something changes ahead of a major release. 

The naming is not the problem since you could just require your controllers like this: require('articles.server.controller') without relying on the extensions property, another thing is that we figured out a lot people use IDE look up(sublimes's ctrl+p, webstorms Ctrl+Shift+N, etc.) so typing your module name then narrowing down the list using server or client seemed like a nice touch. 

It would be lovely if you could help people on this group and the facebook groups, another way to help the community is through PRs, which has great impact on the project development speed, many of the current features are made by the community(e.g., Express 4.x upgrade, Social account management, etc.), so this could also be a great way to influence. 

Anyways keep us updated on what we can do to improve, what are you building with MEAN, and how we can help.

Thanks,
Amos

Asyraf Abdul Rahman

unread,
May 8, 2014, 6:59:56 AM5/8/14
to mea...@googlegroups.com
Hi Amos, 

after playing around with the code abit, I found that the naming convention works, keeps you from getting confused over client vs server files of the same name. kudos! 

I'll fork, explore a few more things - I do have some ideas, but I'm so new, I'll keep them until I'm pretty sure. Thanks! 

netusco

unread,
May 8, 2014, 3:53:31 PM5/8/14
to mea...@googlegroups.com
I agree and like the naming conventions used. 

But I would suggest to change the name of the app folder for client folder, as the files within are named under client. name. This helps in the separation from client vs server.

Thumbs up for the great work!

Ernest
Reply all
Reply to author
Forward
0 new messages