Jump to content
GreenSock

bazookatooth

PixiPlugin error when used with Angular

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

SyntaxError: import declarations may only appear at top level of a module

 

If you take a peek inside the scripts.js that angular compiles it is complaining about this

import { _gsScope } from "./TweenLite.js";

 

My Angular scripts array:

"scripts": [
"node_modules/gsap/pixiplugin.js",
"node_modules/pixi.js/dist/pixi.min.js"
]
Link to comment
Share on other sites

In case it helps anyone, this is the final scripts array I ended with that actually worked.

 

"scripts": [
"node_modules/gsap/src/minified/tweenlite.min.js",
"node_modules/gsap/src/minified/plugins/pixiplugin.min.js",
"node_modules/pixi.js/dist/pixi.min.js"
]
  • Like 1
Link to comment
Share on other sites

10 hours ago, bazookatooth said:

SyntaxError: import declarations may only appear at top level of a module

 

That error happens because the file you had listed was an ES module, which has to be imported. The scripts array expects files that don't have to be imported, i.e. the umd version.

  • Like 2
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×