-
Notifications
You must be signed in to change notification settings - Fork 49
can't import puxi.js from create-react-app #36
Comments
Possible workaround using
Then create
And change the relevant
There's also this sassy, yet functional webpack plugin that I'm using: https://github.com/lukeed/webpack-modules |
I'm not sure why you are closing this since the issue is not solved :) but I guess at least people have two workarounds mentioned here |
I renamed the files: https://github.com/pixijs/pixi-ui/tree/master/packages/core/lib You need install 1.0.0 for the changes to take effect. Is the puxi.js bundle not depending on the 1.0.0 versions of the packages? |
@SukantPal so this is what worked for me:
And then importing it as import * as PUXI from '@puxi/core/lib/puxi-core.js'; So it doesn't require me to copy file anymore since it has proper
So this is great progress from "having to use workarounds" to "usable" :) |
I think this is happening b/c your webpack configuration is importing the CJS bundles pixi.js ( I do want to make this easy for everyone, so let me know if there is something I'm missing. |
Okay, I will try to change module build from.mjs to.es.js and see if it helps. |
This did indeed fix it for me running create-react-app/ react-scripts Could this fix be pushed to npm? |
I'm trying to use puxi in app created with create-react-app, but it can only work with
.js
extension, so here's what I did to make it work for me:then
import * as PUXI from "puxi.js/lib/puxi.js"
.Just to be clear solution I propose is just to rename
.cjs
to.js
as it is inpixi.js
The text was updated successfully, but these errors were encountered: