it('should not drop unused exports by default',async()=>{
constcode=awaitbabel(
// effectful
`import"core-js";`+
// basic
`import{foo,bar}from"a";import baz from"b";`+
// complex
`import baz2,{yeet}from"c";`+
`import baz3,{cats}from"d";`+
`import{c,d}from"e";`+
`import{e as ee,f as ff}from"f";`
)
expect(code).toMatchInlineSnapshot(
`"import\\"core-js\\";import{foo,bar}from\\"a\\";import baz from\\"b\\";import baz2,{yeet}from\\"c\\";import baz3,{cats}from\\"d\\";import{c,d}from\\"e\\";import{e as ee,f as ff}from\\"f\\";"`
it('should not drop unused exports by default in a page',async()=>{
constcode=awaitbabel(
// effectful
`import"core-js";`+
// basic
`import{foo,bar}from"a";import baz from"b";`+
// complex
`import baz2,{yeet}from"c";`+
`import baz3,{cats}from"d";`+
`import{c,d}from"e";`+
`import{e as ee,f as ff}from"f";`,
{resourcePath:pageFile}
)
expect(code).toMatchInlineSnapshot(
`"import\\"core-js\\";import{foo,bar}from\\"a\\";import baz from\\"b\\";import baz2,{yeet}from\\"c\\";import baz3,{cats}from\\"d\\";import{c,d}from\\"e\\";import{e as ee,f as ff}from\\"f\\";"`
)
})
it('should drop unused exports in a modern-apis page',async()=>{
constcode=awaitbabel(
// effectful
`import"core-js";`+
// basic
`import{foo,bar}from"a";import baz from"b";`+
// complex
`import baz2,{yeet}from"c";`+
`import baz3,{cats}from"d";`+
`import{c,d}from"e";`+
`import{e as ee,f as ff}from"f";`+
``+
`export function unstable_getStaticProps() { return { props: {} } }`,