Sunday, 12 March 2017

Import a javascript array in a typescript file

I have a file named array.js which contains a huge number of strings. Something like this :

module.exports = ["word1","word2",...]

I want to use this array in my validation.ts file so what I did was :

let wiki = require('./array.js');

but when I run my tests it says :

WARN [web-server]: 404: /base/out/array.js
[1] Chrome 53.0.2785 (Linux 0.0.0) ERROR
[1]   {
[1]     "originalErr": {}
[1]   }
[1] WARN [web-server]: 404: /base/out/array.js
[1] Firefox 52.0.0 (Ubuntu 0.0.0) ERROR
[1]   {
[1]     "stack": "(SystemJS) XHR error (404 Not Found) loading out/array.js\n\t\n\tError loading out/array.js as \"./array.js\" from out/validation.js",
[1]     "originalErr": {}
[1]   }

I don't know what is the problem



via freeNinja

No comments:

Post a Comment