#Unable to make magicast work

1 messages · Page 1 of 1 (latest)

craggy tiger
#

I'm trying to use magicast for a project, but I'm unable to make it work just like in the examples. I also literally copied the examples but they just don't work, when I print the parseModule result, it is always an empty object {}. Am I missing something?

The examples I'm talking about:

const mod = parseModule(`export default defineConfig({ foo: 'bar' })`)
console.log(mod.exports) // {}

const mod = parseModule(`
import { defineConfig, Plugin } from 'vite'
import Vue from '@vitejs/plugin-vue'
import * as path from 'path'

export default defineConfig({
foo: []
})`)
console.log(mod.exports) // {}
foggy path
#

have you found a solution? i have a similar issue

craggy tiger
foggy path
#

same here haha, ended up using a different solution

mild crater
#

@foggy path @craggy tiger late to the party but:

console.log(mod.exports.default.$ast)

#

gives the result for the very first example

craggy tiger
#

better late than never! thanks 🙂

mild crater
craggy tiger
#

I probably missed that, I wonder what my eyes were looking at 🥲