Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failing #123

Open
ashthornton opened this issue May 13, 2024 · 11 comments
Open

Build failing #123

ashthornton opened this issue May 13, 2024 · 11 comments

Comments

@ashthornton
Copy link

ashthornton commented May 13, 2024

Hi, if I try and build a sketch via npx fragment sketch.js --build it fails with the following error:

SyntaxError: Unexpected token (2:43562) in C:/laragon/www/kikk-24-generator/node_modules/p5/lib/p5.min.js
    at pp$4.raise (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:21621:13)
    at pp$9.unexpected (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:18829:8)
    at pp$5.parseIdentNode (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:21557:10)
    at pp$5.parseIdent (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:21530:19)
    at pp$5.parsePropertyName (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:21349:109)
    at pp$5.parseProperty (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:21272:8)
    at pp$5.parseObj (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:21235:21)
    at pp$5.parseExprAtom (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:20961:17)
    at pp$5.parseExprSubscripts (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:20769:19)
    at pp$5.parseMaybeUnary (file:///C:/laragon/www/kikk-24-generator/node_modules/rollup/dist/es/shared/node-entry.js:20735:17)

I've tried a different p5 version (1.4.1) and the build gives the same error.

Is this something on my end? My project is empty aside from installing fragment and trying to build an empty sketch.

Edit: The build works fine with fragment 0.1.16

@raphaelameaume
Copy link
Owner

Hello! Thanks for reporting this issue.

I merged an issue in dev regarding the build (see #120) but it's not released yet. Can you try giving it an outDir when prompted in the command line?

Otherwise, does this still happen if you installed Fragment locally from the dev branch?

Thanks!

@ashthornton
Copy link
Author

I merged an issue in dev regarding the build (see #120) but it's not released yet. Can you try giving it an outDir when prompted in the command line?

I get the same issue when providing an outDir

Otherwise, does this still happen if you installed Fragment locally from the dev branch?

No it doesn't. Even when I checkout 0.1.17 and run the build function for the examples it runs okay, just with a couple of warnings about dynamic imports from Vite.

For context, my folder structure looks like this:

  • package.json (with fragment)
    • sketches/
      • sketch-name/
        • sketch.js
        • package.json (with three and p5)

And I'm running fragment from within the sketch-name/ folder. But I've also tried installing three and p5 in the root folder and running the build function from there which gives the same error.

Here is the output:

PS C:\laragon\www\kikk-24-generator\sketches\ash-01> npx fragment sketch.js --build        
[fragment] v0.1.17

 build  sketch.js

Output directory:
sketch

Base public path:
/

 build  Building sketch.js for production...

Generating files...
Creating Vite configuration...
vite v4.5.3 building for production...
✓ 137 modules transformed.
✓ built in 1.90s
[commonjs--resolver] Unexpected token (3:42324) in C:/laragon/www/kikk-24-generator/sketches/ash-01/node_modules/p5/lib/p5.min.js
file: C:/laragon/www/kikk-24-generator/sketches/ash-01/node_modules/p5/lib/p5.min.js:3:42324

Does anything look out of the ordinary here?

@raphaelameaume
Copy link
Owner

Thanks for the details. No it should work the way you did it, I'll give it a try.

The error does ring a bell though, I'll have a look

@raphaelameaume
Copy link
Owner

raphaelameaume commented May 14, 2024

Ok this seems to be a Vite issue, fixed in 5.0.0. Can you check what is the version of Vite used by your local install of Fragment in [root]/node_modules/vite/package.json ?

If it's under 5.0 (it should be), can you force an install of Vite with npm install vite@5.0.0 and try to re-run the build command for Fragment. Does it go through?

@ashthornton
Copy link
Author

Yeah that fixed it, I also had to update @sveltejs/vite-plugin-svelte so it was compatible with the new Vite version too

@raphaelameaume
Copy link
Owner

I need to run some tests to update to the dependencies to Vite 5 but it will be fixed in the next release. Thanks for spotting this issue!

@ashthornton
Copy link
Author

Thanks for the quick fix 😄

@M0nica
Copy link

M0nica commented Jun 1, 2024

Yeah that fixed it, I also had to update @sveltejs/vite-plugin-svelte so it was compatible with the new Vite version too

Which versions of vite and @sveltejs/vite-plugin-svelte did you end up using to resolve the build issue?

These are my updated local dependencies but they don't seem to be working around the build issue :

     "p5": "^1.9.4",
    "vite": "^5.0.0",
    "@sveltejs/vite-plugin-svelte": "^3.1.1"

@ashthornton
Copy link
Author

Yeah that fixed it, I also had to update @sveltejs/vite-plugin-svelte so it was compatible with the new Vite version too

Which versions of vite and @sveltejs/vite-plugin-svelte did you end up using to resolve the build issue?

These are my updated local dependencies but they don't seem to be working around the build issue :

     "p5": "^1.9.4",
    "vite": "^5.0.0",
    "@sveltejs/vite-plugin-svelte": "^3.1.1"

Did you install these inside the node_modules/fragment-tools folder rather than your project's root folder?

@M0nica
Copy link

M0nica commented Jun 4, 2024

Yeah that fixed it, I also had to update @sveltejs/vite-plugin-svelte so it was compatible with the new Vite version too

Which versions of vite and @sveltejs/vite-plugin-svelte did you end up using to resolve the build issue?
These are my updated local dependencies but they don't seem to be working around the build issue :

     "p5": "^1.9.4",
    "vite": "^5.0.0",
    "@sveltejs/vite-plugin-svelte": "^3.1.1"

Did you install these inside the node_modules/fragment-tools folder rather than your project's root folder?

I tried updating the dependencies both in my project's root folder and inside of my global installation of fragment-tools.

@M0nica
Copy link

M0nica commented Jun 4, 2024

I was able to get the build to finish with a different error (progress!) after switching from the global instance of Fragment to a version local to my project folder and updating the dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants