0

as title

I try this but I got the error message "Cannot find module"

var path = '../fake-api/data.json';
require(path);

1 Answer 1

0

It should look like

define(["require","../fake-api/data.json"],function(require){
     var data= require("../fake-api/data.json");
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.