if you use @masiv/addon-system need to remove it
npm un @masiv/addon-system
npm i @oasis/system
IMPORTANT! Latest stable version: 1.0.0
To make use of the environment variables inside the project just call it as follows:
"serve": "**oasis-sc** configure ..."
...
import Vue from 'vue';
import '@oasis/system'
...
❗ You must import the System in the top, just after importing the Vue instance
In your project root folder, create a mui-conf.js file with the following structure:
module.exports = {
"dev": {
// dev/local environment variables
"appName": String,
"urlResources": String,
},
"test": {
// test environment variables
"appName": String,
"urlResources": String,
},
"prod": {
// production environment variables
"appName": String,
"urlResources": String,
},
};
ℹ️ You can add as many environment variables as you need to meet your app requirements.
Change @masiv/addon-system to @oasis/system
// Example code
const fs = require('fs');
const masivSystem = require('@oasis/system');
const conf = global.conf;
const testFolder = './dist/js/';
const outputFolder = './dist/js/import.json';
const regxFile = /^(app)\\.[0-9a-z]+\\.js+$/i;
let fileName = '';
console.log('1/5 read dist folder...');
fs.readdirSync(testFolder).forEach((x) => {
if (regxFile.test(x)) {
fileName = x;
} else {
return null;
}
});
console.log('2/5 app name found: ', fileName);
const template = `{
"imports": {
"${conf.appName}": "${conf.urlResources}/js/${fileName}"
}
}`;
console.log('3/5 template: ', template);
console.log('4/5 writing new import.json...');
fs.writeFile(outputFolder, template, function (err, data) {
if (err) {
return console.log(err);
}
console.log(data);
});
console.log('5/5 file rewrited: ', outputFolder);
console.log('import.json finished!');