Skip to content

Commit

Permalink
fix: remove unconditional external from vite build (#6554)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricokahler authored May 3, 2024
1 parent 5a889fc commit f1e9546
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/sanity/src/_internal/cli/server/getViteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export async function getViteConfig(options: ViteOptions): Promise<InlineConfig>
},
}

const addImportMap = false

if (mode === 'production') {
viteConfig.build = {
...viteConfig.build,
Expand All @@ -128,7 +130,9 @@ export async function getViteConfig(options: ViteOptions): Promise<InlineConfig>
emptyOutDir: false, // Rely on CLI to do this

rollupOptions: {
external: [/^sanity(\/.*)?$/, 'react', 'react/jsx-runtime', 'styled-components'],
external: addImportMap
? [/^sanity(\/.*)?$/, 'react', 'react/jsx-runtime', 'styled-components']
: [],
input: {
sanity: path.join(cwd, '.sanity', 'runtime', 'app.js'),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/core/components/DefaultDocument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const EMPTY_ARRAY: never[] = []
* @beta */
export function DefaultDocument(props: DefaultDocumentProps): ReactElement {
const {entryPath, css = EMPTY_ARRAY, basePath = '/'} = props
const addImportMap = true
const addImportMap = false
return (
<html lang="en">
<head>
Expand Down

0 comments on commit f1e9546

Please sign in to comment.