Comments (4)
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.
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.
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.
Thanks Greg for getting it green
from rules_js.
Related Issues (20)
- Documentation `data` of `npm_translate_lock` outdated?
- [Bug]: js_image_layer puts both first-party and third-party code into same layer HOT 3
- [Bug]: pnpm_lock attribute is required, and npm_link_all_packages crashes without it
- [Bug]: vite+vue-router alias work error HOT 1
- [FR]: Support lockfile v9 and pnpm 9 HOT 3
- [Bug]: Local NPM package don't transitively propagate node_modules HOT 1
- [Bug]: pnpm lockfile occasional has improperly escaped urls HOT 1
- [Bug]: __dirname is not hermetic
- 2.0 RELEASE HOT 6
- [Bug]: use of bzlmod repo_name causes error HOT 2
- [FR]: support pnpm.onlyBuiltDependencies HOT 1
- [Bug]: on 1.x, IDE types can sometimes not match ts_project types, causing builds to fail for resolving the wrong type package
- [FR]: Automatically generate binary and library targets HOT 7
- [Bug]: bazel run -- @pnpm//:pnpm does not work HOT 2
- [FR]: add `rules_license` providers to NPM imported packages HOT 1
- [Bug]: bsdtar.exe fails to run on Windows HOT 1
- [Bug]: rules_js 2.0 pnpm 9 fails to load pnpm-lock.yaml HOT 19
- [FR]: Preventing input leakage via global caches
- [Bug]: pnpm v9 lockfile issues HOT 1
- [Bug]: error from aspect_rules_js/js/private/node-patches/register.js with type=module in package.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_js.