简体   繁体   中英

ES6 Module Imports into multiple JS files

I'm new to using imports/exports with ES6. I am currently messing around with PixiJs, webpack, and babel. I was wondering if I need to import my pixijs script into each script I would use it. Do I need to do import * as PIXI from 'pixi.js in every single JS file that would use it, or does it only need to be imported once? I have tried looking the answer up, but I can't seem to think of a good way to word it that results in any kind of relevant answer.

No. You only need to import it in those files which require access to PIXI . Other js files that don't create new applications/sprites/whatever in Pixi do not need to have it imported.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM