Jump to content

Import js file to theme.js


compsoul.dev

Recommended Posts

import Carousel from "./modules/carousel";

(function() {
  console.log(new Carousel("body"));
})();

I have this code in theme.js and in modules folder this one:

export default class Carousel {
Class stuff...
}

Why this code dosnt work? Errors:
FF: SyntaxError: import declarations may only appear at top level of a module
Chrom: Uncaught SyntaxError: Unexpected identifier
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...