Skip to content

Commit

Permalink
fix: opt in to import.meta.* properties (#978)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 25, 2024
1 parent 1a7483d commit bc38fd9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
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

0 comments on commit bc38fd9

Please sign in to comment.