I am trying to convert a file tensorflow.js file (written in Node.js) with Browserify into plain Javascript. In the file there are two lines
import * as tf from '@tensorflow/tfjs';
import {MnistData} from './data';
When I am exporting this I am getting the error "ParseError: 'import' and 'export' may appear only with 'sourceType: module'". How can I solve this error?
Many thanks in advance, Andi
You can use esmify
to add ES Modules support to browserify:
browserify index.js -p esmify > bundle.js
Refer to the project's readme for more usage info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With