Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use import statement outside a module error when loading chrome extension #5

Open
aimanuslim opened this issue Mar 6, 2021 · 1 comment

Comments

@aimanuslim
Copy link

Hi, I copied the manifest.json file out of dist into the root folder and load the whole folder unpacked into chrome. (I cant load just the manifest in the dist folder, its giving me other errors).

But now, I am getting this error below regarding not able to import statement outside of module. Is this a new thing with chrome extensions?


Uncaught SyntaxError: Cannot use import statement outside a module
Context
_generated_background_page.html
Stack Trace
src/background.js:1 (anonymous function)

import 'babel-polyfill'; <--- this line is highlighted indicating its the cause of the error
import * as tf from '@tensorflow/tfjs';
import { IMAGENET_CLASSES } from './imagenet_classes';

const MOBILENET_MODEL_PATH = 'https://storage.googleapis.com/tfjs-models/tfjs/mobilenet_v1_0.25_224/model.json';
const IMAGE_SIZE = 224;
const TOPK_PREDICTIONS = 10;

class BackgroundProcessing {
@xX-GeoffreyG-Xx
Copy link

xX-GeoffreyG-Xx commented Jan 23, 2024

I've just found this project today, because I was having a hard time getting TensorFlow to work with my Google Extension. But when I try to install this extension, I'm seeing this same problem:

Uncaught SyntaxError: Cannot use import statement outside a module
Context
_generated_background_page.html
Stack Trace
src/background.js:1 (anonymous function)

Does this Chrome Extension work in current versions of Chrome? I'm running Chrome Version 120.0.6099.225.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants