index.js 493 B

1234567891011121314
  1. const { loadBinding } = require('@node-rs/helper')
  2. try {
  3. // __dirname means load native addon from current dir
  4. // 'index' means native addon name is `index`
  5. // the value of this two arguments was decided by `build` script in `package.json`
  6. module.exports = loadBinding(__dirname, 'index')
  7. } catch (e) {
  8. try {
  9. module.exports = require(`@swc-node/core-${platform()}`)
  10. } catch (e) {
  11. throw new TypeError('Not compatible with your platform. Error message: ' + e.message)
  12. }
  13. }