Unverified Commit 95a8f31d authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix outputStandalone with optimizeCss (#36028)

parent 8c579795
...@@ -2085,14 +2085,15 @@ export default async function build( ...@@ -2085,14 +2085,15 @@ export default async function build(
}, []), }, []),
]) { ]) {
const filePath = path.join(dir, file) const filePath = path.join(dir, file)
await promises.copyFile( const outputPath = path.join(
filePath, distDir,
path.join( 'standalone',
distDir, path.relative(outputFileTracingRoot, filePath)
'standalone',
path.relative(outputFileTracingRoot, filePath)
)
) )
await promises.mkdir(path.dirname(outputPath), {
recursive: true,
})
await promises.copyFile(filePath, outputPath)
} }
await recursiveCopy( await recursiveCopy(
path.join(distDir, SERVER_DIRECTORY, 'pages'), path.join(distDir, SERVER_DIRECTORY, 'pages'),
......
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { renderViaHTTP } from 'next-test-utils'
describe('standalone mode and optimizeCss', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
'pages/index.js': `
import styles from './index.module.css'
export default function Page() {
return <p className={styles.home}>hello world</p>
}
`,
'pages/index.module.css': `
.home {
background: orange;
color: black;
}
`,
},
nextConfig: {
experimental: {
optimizeCss: true,
outputStandalone: true,
},
},
dependencies: {
critters: 'latest',
},
})
})
afterAll(() => next.destroy())
it('should work', async () => {
const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('hello world')
expect(html).toContain('background:orange')
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment