Code Monkey home page Code Monkey logo

Comments (4)

alexeagle avatar alexeagle commented on June 11, 2024

I've been working on this in a branch:
https://github.com/bazelbuild/examples/compare/nextjs_standalone

Some observations:

  • next.js wants to copy node_modules from the working directory into the .next/standalone output directory.
  • rules_js patches the Node.js runtime to make symlinks exiting the sandbox appear as regular files. patch_node_fs = False would stop that happening, but causes a different error, it appears in that branch
  • We ought to be able to remove the dangling symlinks after next.js finishes running webpack. In that branch I have a workaround.js which tries to do that by hooking process.on('exit', ...) - however it's getting run many times, and seems to run too early, as webpack then errors that it can't find node_modules entries
  • it seems like --sandbox_debug (and possibly --noincompatible_sandbox_hermetic_tmp) cause the output to be better-formed such that I was able to get the build action to succeed, and even run node server.js in the resulting output tree
  • running outside of the sandbox might help.

from examples.

alexeagle avatar alexeagle commented on June 11, 2024

Sorry I ran out of time to work on this, I had a short-term funding source for 30min of hand-on-help but we only scheduled two of those.

from examples.

alexeagle avatar alexeagle commented on June 11, 2024

@gregmagolan has a solution for this now.

from examples.

gregmagolan avatar gregmagolan commented on June 11, 2024

We were able to get next start to work without needed standalone mode.

Would be good to get a proper example landed here in the future but for now here is a link to a delta with some comments on the changes: https://github.com/be9/bazelbuild-examples/pull/2/files

Since the example is bzlmod only we should probably fix the bzlmod toolchain issue first: aspect-build/rules_js#1530

from examples.

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.