fdusautoir
38
1
Vue

Concatenation in require

Posted 9 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 :)

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.