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: opt in to import.meta.* properties #978

Merged
merged 2 commits into from
Mar 25, 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
1 change: 1 addition & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export default defineNuxtModule<SanityModuleOptions>({
version,
configKey: CONFIG_KEY,
compatibility: {
nuxt: '^3.7.0',
bridge: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/sanity-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function extractProps (item: Block, isElement: boolean) {
function renderBlocks (blocks: Array<Block>, serializers: Required<Serializers>) {
return blocks.map((block) => {
const node = renderStyle(block, serializers, () => renderInSerializer(block, serializers))
if (process.env.NODE_ENV === 'development' && (!node || (Array.isArray(node) && !node.length))) {
if (import.meta.dev && (!node || (Array.isArray(node) && !node.length))) {
// eslint-disable-next-line no-console
console.warn(`No serializer found for block type "${block._type}".`, block)
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/minimal-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function createClient (config: ClientConfig) {
headers: {
...(token ? { Authorization: `Bearer ${token}` } : {}),
Accept: 'application/json',
...(process.server ? { 'accept-encoding': 'gzip, deflate' } : {}),
...(import.meta.server ? { 'accept-encoding': 'gzip, deflate' } : {}),
},
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/server/routes/preview/enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default defineEventHandler(async event => {

setCookie(event, '__sanity_preview', $config.sanity.visualEditing!.previewModeId, {
httpOnly: true,
sameSite: process.env.NODE_ENV !== 'development' ? 'none' : 'lax',
secure: process.env.NODE_ENV !== 'development',
sameSite: !import.meta.dev ? 'none' : 'lax',
secure: !import.meta.dev,
path: '/',
})

Expand Down
Loading