Concatenation in require

Published 3 months ago by fdusautoir

Hi Everybody,

I have a very strange problem.

All this code below is working fine :

        payload.modules.forEach(function(mod) {

            var modules_path = '../../modules/';

            // Routes
            router.addRoutes(require('../../modules/'+mod.module_id+'/routes.js'));
            // Store
            store.registerModule(['modules', mod.module_id],
        require('../../modules/'+mod.module_id+'/store.js').default);

        });

But when I use the modules_path variable into my require like this :

        payload.modules.forEach(function(mod) {

            var modules_path = '../../modules/';

            // Routes
            router.addRoutes(require(modules_path+mod.module_id+'/routes.js'));
            // Store
            store.registerModule(['modules', mod.module_id],
        require('../../modules/'+mod.module_id+'/store.js').default);

        });

What can explains that ? That seems to be the same for me.

Thanks for your help :)

fdusautoir

Any help ? :/

Please sign in or create an account to participate in this conversation.