Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unconditional external from vite build #6554

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading