import Transform from '@core/lib/swc/transform'
import path from 'path'

export default (root) => ({
  jsc: {
    baseUrl: '.',
    paths: {
      '@apps/*': [path.resolve(root,'apps','*')],
      '@core/*': [path.resolve(root,'core','*')],
      '@web/*': [path.resolve(root,'web','*')]
    },
    parser: {
      syntax: 'ecmascript',
      jsx: true,
      exportDefaultFrom: true,
      exportNamespaceFrom: true
    },
    target: 'es5'
  },
  module: {
    type: 'commonjs'
  },
  sourceMaps: true,
  plugin: (m) => new Transform().visitProgram(m)
})
