I have a script that I run post ng build that is located in my assets/js folder. In that script, I call an api and need to use an access token to do so. I tried to place this access token in the environments/environment.ts folder, but during execution of the script, the environment module cannot be found. How can I access environment.ts values in the assets folder?
const request = require('request');
const fs = require('fs');
const path = require('path');
const process = require('process');
fs.readdir('./dist/app', function(err,files) {
if(err) {
console.error( "Could not list the directory.", err );
process.exit( 1 );
}
});
const sendFile = function(file){
request({
url: 'https://api.rollbar.com/api/1/sourcemap',
headers: {
'content-type': 'multipart/form-data'
},
method: 'POST',
multipart: [
{
'Content-Disposition': 'form-data; name="access_token"',
body: environment.rollbar.accessToken //this is what I need
}
]
}, function(err, response, body) { if(err){ console.log('Could not send file', err) } else { console.log(body) } });