remove fs from web build on selectAsset
This commit is contained in:
parent
d70d964d0c
commit
1d79aa4537
1 changed files with 4 additions and 0 deletions
|
@ -4,7 +4,9 @@ import React, { useState } from 'react';
|
||||||
import { FormField } from 'component/common/form';
|
import { FormField } from 'component/common/form';
|
||||||
import FileSelector from 'component/common/file-selector';
|
import FileSelector from 'component/common/file-selector';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
// @if TARGET='app'
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
// @endif
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import uuid from 'uuid/v4';
|
import uuid from 'uuid/v4';
|
||||||
|
|
||||||
|
@ -34,6 +36,7 @@ function SelectAsset(props: Props) {
|
||||||
|
|
||||||
function doUploadAsset(filePath, thumbnailBuffer) {
|
function doUploadAsset(filePath, thumbnailBuffer) {
|
||||||
let thumbnail, fileExt, fileName, fileType;
|
let thumbnail, fileExt, fileName, fileType;
|
||||||
|
// @if TARGET='app'
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
thumbnail = fs.readFileSync(filePath);
|
thumbnail = fs.readFileSync(filePath);
|
||||||
fileExt = path.extname(filePath);
|
fileExt = path.extname(filePath);
|
||||||
|
@ -47,6 +50,7 @@ function SelectAsset(props: Props) {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// @endif
|
||||||
|
|
||||||
const uploadError = (error = '') => {
|
const uploadError = (error = '') => {
|
||||||
console.log('error', error);
|
console.log('error', error);
|
||||||
|
|
Loading…
Reference in a new issue