editor-js / editor-js/image

Production build errror appear.

Open
#91 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
285
Forks
307
PR merge metrics
No merged PRs in 30d

Description

Hi, I`m using editor.js/image in my next.js app.

So the problem is that on production build (on server) I can`t use image, becase of this error:
`Uncaught TypeError: Cannot read property 't' of undefined`

On localhost production build I have no errors,
Api is absolutly worked, so there`s my configs:

Editor.js config file:
`import React from "react";

import EditorJS from "@editorjs/editorjs";
import ImageTool from '@editorjs/image';
import List from '@editorjs/list'
import LinkTool from '@editorjs/link'
import Header from '@editorjs/header'
import Paragraph from '@editorjs/paragraph'
import {MDBBtn} from "mdbreact";

export default function EditorConfig({save, data, placeholder}){
const editor = new EditorJS({
holder: "editorjs",
placeholder: placeholder || 'Добавьте контент',
tools: {
image: {
class: ImageTool,
config: {
endpoints: {
byFile: process.env.HOST_API + '/file_upload', // Your backend file uploader endpoint
},
additionalRequestHeaders: {
Authorization: 'Bearer token'
}
},
},
header: {
class: Header,
config: {
placeholder: 'Добавьте заголовок',
levels: [2, 3, 4],
defaultLevel: 3
}
},
linkTool: {
class: LinkTool,
config: {
endpoint: process.env.HOST_API + '/link', // Your backend endpoint for url data fetching
}
},
paragraph: {
class: Paragraph,
inlineToolbar: true,
},
list: {
class: List,
inlineToolbar: true,
},
},
data: {blocks: data !== undefined ? JSON.parse(data) : ""}
})

function getData() {
editor.save().then((outputData) => {
save(outputData);
}).catch((error) => {
console.log('Saving failed: ', error)
});
}

return (
<>


{data !== undefined ? "Редактировать" : "Создать"}

)
}
`

package.json:
`{
"name": "gipp",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@vyppn/chameleon-react": "^1.0.1",
"axios": "^0.19.2",
"color-picture": "^0.1.7",
"color.js": "^0.1.3",
"cross-fetch": "^3.0.4",
"fast-average-color": "^6.0.2",
"fetch": "^1.1.0",
"isomorphic-unfetch": "^3.0.0",
"js-cookie": "^2.2.1",
"jsonwebtoken": "^8.5.1",
"mdbreact": "^4.26.0",
"next": "9.3.6",
"next-redux-wrapper": "^6.0.0",
"react": "16.13.1",
"react-cookie": "^4.0.3",
"react-dom": "16.13.1",
"react-redux": "^7.2.0",
"react-share": "^4.1.0",
"react-toastify": "^6.0.0-rc.3",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"tinycolor2": "^1.4.1",
"trim-characters": "^1.4.0"
},
"devDependencies": {
"@editorjs/delimiter": "^1.1.0",
"@editorjs/editorjs": "^2.17.0",
"@editorjs/header": "^2.4.1",
"@editorjs/image": "latest",
"@editorjs/link": "^2.1.3",
"@editorjs/list": "^1.4.0",
"@editorjs/paragraph": "^2.6.1",
"@editorjs/quote": "^2.3.0"
}
}
`

So, I have an idea that it`s gzip or something else, btw can you help me with it?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.