Giter Club home page Giter Club logo

Comments (4)

alexeagle avatar alexeagle commented on June 15, 2024

Started this here: https://github.com/aspect-build/bazel-examples/tree/react/react/create-react-app

Failing with

Creating an optimized production build...
Failed to compile.

SyntaxError: /shared/cache/bazel/user_base/0665ff20446a8ec57f994c91843cbe67/execroot/__main__/bazel-out/k8-fastbuild/bin/src/index.js: Support for the experimental syntax 'jsx' isn't currently enabled (9:3):
   7 | const root = ReactDOM.createRoot(document.getElementById('root'));
   8 | root.render(
>  9 |   <React.StrictMode>
     |   ^
  10 |     <App />
  11 |   </React.StrictMode>
  12 | );

Add @babel/preset-react (https://github.com/babel/babel/tree/main/packages/babel-preset-react) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx) to the 'plugins' section to enable parsing.

from rules_js.

alexeagle avatar alexeagle commented on June 15, 2024

FYI @gregmagolan I upgraded to the 1.0.0 and still fails like this:

/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/build__js_binary.sh.runfiles/__main__/node_modules/.aspect_rules_js/[email protected]_qtbnez4q7bzoc4eqybg3efzzxe/node_modules/react-scripts/scripts/build.js:19
  throw err;
  ^

RpcRemoteError: ENOENT: no such file or directory, realpath '/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/react'
    at enoent (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/external/aspect_rules_js/js/private/node-patches/fs.js:752:15)
    at guardedRealPathSync (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/external/aspect_rules_js/js/private/node-patches/fs.js:651:23)
    at Object.fs.realpathSync (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/external/aspect_rules_js/js/private/node-patches/fs.js:181:20)
    at getRealPath (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/build__js_binary.sh.runfiles/__main__/node_modules/.aspect_rules_js/[email protected]_rvmon6ehd2r54ktaosvxv4i2y4/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/file-system/RealFileSystem.js:73:100)
    at Object.realPath (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/build__js_binary.sh.runfiles/__main__/node_modules/.aspect_rules_js/[email protected]_rvmon6ehd2r54ktaosvxv4i2y4/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/file-system/RealFileSystem.js:153:20)
    at Object.readStats (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/build__js_binary.sh.runfiles/__main__/node_modules/.aspect_rules_js/[email protected]_rvmon6ehd2r54ktaosvxv4i2y4/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/file-system/PassiveFileSystem.js:59:45)
    at Object.directoryExists (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/build__js_binary.sh.runfiles/__main__/node_modules/.aspect_rules_js/[email protected]_rvmon6ehd2r54ktaosvxv4i2y4/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js:147:58)
    at Object.directoryProbablyExists (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/typescript/lib/typescript.js:19354:46)
    at getPackageJsonInfo (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/typescript/lib/typescript.js:43797:34)
    at loadModuleFromSpecificNodeModulesDirectory (/shared/cache/bazel/user_base/94b49c00ba73c41eeaf34473af5ccd8a/sandbox/linux-sandbox/10/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/typescript/lib/typescript.js:44337:27)

from rules_js.

alexeagle avatar alexeagle commented on June 15, 2024

Note, this one does work for me https://github.com/heartless-clown/bazel_aspect_rules_js_react/blob/ejected/app/react-app/BUILD.bazel#L111-L112
though I think we'd want to review how that's done before cloning to our own examples.

from rules_js.

alexeagle avatar alexeagle commented on June 15, 2024

Thanks Greg for getting it green

from rules_js.

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.