Skip to content

Commit

Permalink
Merge pull request #51 from BKWLD/es6-exports
Browse files Browse the repository at this point in the history
Switch to ES6 exports
  • Loading branch information
weotch authored Sep 9, 2024
2 parents 68ef6ca + 4efe097 commit 8235e53
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Image and video renderer for Contentful assets.",
"author": "Bukwild <[email protected]>",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/next/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Configuration of next/image for Cypress tess
module.exports = {
export default {
images: {

// Disable Next.js producing it's own crops within dev server which don't
Expand Down
1 change: 1 addition & 0 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Image and video renderer for Next.js projects",
"author": "Bukwild <[email protected]>",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
6 changes: 5 additions & 1 deletion packages/next/src/NextVisual.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Image from 'next/image'
// `next/image` as importing as { default: Image, __esmodule: true } when
// this file was loaded by @react-visual/sanity-next. This is my hack to fix
import _Image from "next/image";
const Image = ("default" in _Image ? _Image.default : _Image) as typeof _Image;

import type { ReactElement } from 'react'

import { makeImagePlaceholder } from './lib/placeholder'
Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Image and video renderer for React projects",
"author": "Bukwild <[email protected]>",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity-next/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Configuration of next/image for Cypress tess
module.exports = {
export default {
images: {

// Support tests fetching imaages from placehold.co
Expand Down
1 change: 1 addition & 0 deletions packages/sanity-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Image and video renderer for Sanity + Next.js projects",
"author": "Bukwild <[email protected]>",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
8 changes: 6 additions & 2 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"target": "es2022",
"module": "es2022",
"declaration": true,
"outDir": "./dist",
"strict": true,
Expand All @@ -10,6 +10,10 @@
// Required for importing packages, like React, that have `export =`
"esModuleInterop": true,

// Recommendations for greater interoperability
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",

// Fixes build failures when dependent types have errors, like:
// node_modules/next/dist/shared/lib/get-img-props.d.ts:70
"skipLibCheck": true,
Expand Down

0 comments on commit 8235e53

Please sign in to comment.