I'm doing super hacky stuff. I usually write my own build scripts that reads code from different files and writes them into the new files, then I remove the exportimport keywords from the code string and minify it.
Here's my build script
constfse=require('fs-extra');constminify=require('@node-minify/core');constterser=require('@node-minify/terser');console.log("Build started... \n🌻");fse.removeSync('dist');fse.copySync('src','dist');// Read from both the filesconstvoicesFile=fse.readFileSync('src/voices.mjs');constindexFile=fse.readFileSync('src/index.mjs');// Bundle them togetherletbolFile=voicesFile+'\n'+indexFile;// Remove export import keywordsbolFile=bolFile.replace(/\b.*(export default).*/g,'').replace(/\b(export)\b/g,'').replace(/\b.*(import).*/g,'')// Write into new filesfse.writeFileSync('dist/bol.js',bolFile);// Create a minified version of new fileminify({compressor:terser,input:'dist/bol.js',output:'dist/bol.min.js',callback:function(err,min){}});console.log(" DONE 🎉");
Though this is not ideal when you have to change the directory structure multiple times. This just works for me since I don't have to add/remove new files for that particular usecase
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm doing super hacky stuff. I usually write my own build scripts that reads code from different files and writes them into the new files, then I remove the
export
import
keywords from the code string and minify it.Here's my build script
Though this is not ideal when you have to change the directory structure multiple times. This just works for me since I don't have to add/remove new files for that particular usecase