Closed IdkGoodName closed 3 years ago
var compile = require('@sweet-js/core').compile;
var NodeLoader = require('@sweet-js/core/dist/node-loader').default;
let loaderOptions = {
noBabel: false
};
var loader = new NodeLoader(process.cwd(), loaderOptions);
try{
var output = compile(fs.realpathSync("your_path"), loader, {
noBabel: ''
});
console.log(output.code)
} catch (e) {
console.log(e)
}
This is the way I could compile sweet.js with node.js.
I want to use sweet.parse or sweet.compile
But for some reason I need to provide loader.compile function.
Is there anyway to use sweet.parse or sweet.compile? I need to parse Sweet JS inside of function.