Git Product home page Git Product logo

Comments (4)

bigtimebuddy avatar bigtimebuddy commented on April 28, 2024

I would probably try to look for a Rollup plugin that could statically inline dynamic imports. We are now using dynamic imports which helps tree-shaking and up-front filesize costs for some bundlers. Since we added another big renderer in v8, it's just not practical to load everything at once.

Quick search found this issue:
rollup/rollup#3490

from pixijs.

danielbarion avatar danielbarion commented on April 28, 2024

Thanks for the issue reference @bigtimebuddy, I checked it and ESM on CanIUse:

image

The ESM is already supported by ~96% of browsers, and the version range is great.

Changing the build to use esm directly looks to be the right approach.

I still have other things broken after migrate to v8 that is mentioned on the following issue: #10299

So, when I run the project, on the browser I get the following error:

Uncaught TypeError: Failed to resolve module specifier "@pixi/core". Relative references must start with either "/", "./", or "../".

The browser was not able to load the Pixi core, and those are the built files:
image

I'll wait for the other issue and keep doing some tests to see how to fix it.

from pixijs.

danielbarion avatar danielbarion commented on April 28, 2024

hey guys, question about v8 and the ESM build, the following code is being included on the top of the build files:

import { SCALE_MODES, extensions as extensions$1, ExtensionType as ExtensionType$1, ObjectRenderer, Buffer as Buffer$1, utils, Shader, Program, Matrix as Matrix$1, Geometry as Geometry$1, Texture as Texture$1, groupD8 as groupD8$1, DRAW_MODES } from '@pixi/core';
import { Container as Container$1, Bounds as Bounds$1 } from '@pixi/display';

I don't have @pixi/display and @pixi/core as dependencies or dev dependencies on my project because I didn't need it on v7, but now it is being included on the build file and when the browser try to load it, I get the following error Uncaught TypeError: Failed to resolve module specifier "@pixi/core". Relative references must start with either "/", "./", or "../". because it is not being included on build file.

image

if I define it to load from CDN it works and the error goes away:

      paths: {
        '@pixi/core': 'https://cdn.skypack.dev/@pixi/core',
        '@pixi/display': 'https://cdn.skypack.dev/@pixi/display',
      },

is this an expected behavior/approach? I would like to not need this map with the CDN to fill all the needs of Pixi on my build...

can someone please give me some guidance about it? thanks!

from pixijs.

danielbarion avatar danielbarion commented on April 28, 2024

the issue is that @pixi/tilemap and other plugins are still on v7, so they need to be upgraded, after that, the build will work as expected.

Closing as there's nothing to be done here by Pixi team.

from pixijs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.