I am using react server side rendering with node to generate pdf.
I have 3 files
index.js, PDF.jsx, helper.jsx
index.js contains following code.
let fileContent = await Fsp.readFile('PDF.jsx', 'utf-8');
let code = Babel.transform(fileContent, {
presets: ['@babel/preset-env', '@babel/preset-react'],
comments: false,
minified: true
}).code;
PDF.jsx contains following import
import * as Helper from './Helper.jsx';
Helper.jsx contains following code
class Helper{
}
export default Helper;
But it gives following error
export default Helper;
^^^^^^
SyntaxError: Unexpected token export
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)