N
Nuxt9mo ago
Lannister

Unable to Achieve Desired Library Auto-import Syntax in nuxt.config.ts

// I tried the following approaches,
// intending to achive the following library
// auto-import in SFCs

// import { * as yup } from 'yup',

// First non-wworking attempt:
imports: {
presets: [
{
from: 'yup',
imports: [
['*', 'yup'] // import * as Yup from 'yup'
],
},
],
},

// Second non-wworking attempt:
imports: {
imports: [
{
yup: [
['*', 'yup'], // import * as Yup from 'yup'
],
},
],
},
// I tried the following approaches,
// intending to achive the following library
// auto-import in SFCs

// import { * as yup } from 'yup',

// First non-wworking attempt:
imports: {
presets: [
{
from: 'yup',
imports: [
['*', 'yup'] // import * as Yup from 'yup'
],
},
],
},

// Second non-wworking attempt:
imports: {
imports: [
{
yup: [
['*', 'yup'], // import * as Yup from 'yup'
],
},
],
},
<script setup lang="ts">
// Desired result:
import { * as yup } from 'yup',
</script>
<script setup lang="ts">
// Desired result:
import { * as yup } from 'yup',
</script>
8 Replies
manniL
manniL9mo ago
Try
{
from: 'yup',
imports: [
{ name: 'default', as: 'yup' }
]
}
{
from: 'yup',
imports: [
{ name: 'default', as: 'yup' }
]
}
or sth. similar Ah, nevermind
{
from: 'three',
imports: [['*', 'THREE']],
},
{
from: 'three',
imports: [['*', 'THREE']],
},
is from the testsuite Seems correct 🤔 ah no it works? 🤔
Lannister
LannisterOP9mo ago
you are rockstar !
manniL
manniL9mo ago
Fine with your syntax too 🙂
Lannister
LannisterOP9mo ago
not sure why my syntax didn't work, yours worked right away
manniL
manniL9mo ago
but yours should too 😄 Maybe server restart? 🤔
Lannister
LannisterOP9mo ago
no idea! could be, I will experiment and get back ohhh I know why it didnt work typo haha thanks!
manniL
manniL9mo ago
Ahh! 😄
Want results from more Discord servers?
Add your server