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 FileSelector from 'component/common/file-selector';
|
||||
import Button from 'component/button';
|
||||
// @if TARGET='app'
|
||||
import fs from 'fs';
|
||||
// @endif
|
||||
import path from 'path';
|
||||
import uuid from 'uuid/v4';
|
||||
|
||||
|
@ -34,6 +36,7 @@ function SelectAsset(props: Props) {
|
|||
|
||||
function doUploadAsset(filePath, thumbnailBuffer) {
|
||||
let thumbnail, fileExt, fileName, fileType;
|
||||
// @if TARGET='app'
|
||||
if (filePath) {
|
||||
thumbnail = fs.readFileSync(filePath);
|
||||
fileExt = path.extname(filePath);
|
||||
|
@ -47,6 +50,7 @@ function SelectAsset(props: Props) {
|
|||
} else {
|
||||
return null;
|
||||
}
|
||||
// @endif
|
||||
|
||||
const uploadError = (error = '') => {
|
||||
console.log('error', error);
|
||||
|
|
Loading…
Reference in a new issue