You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✘ [ERROR] /Users/kesha/projects/nano_gym_tma/src/app/styles.tsx: A stylex namespace must be an object. [plugin esbuild-plugin-stylex]
node_modules/@stylexjs/babel-plugin/lib/index.js:2947:10:
2947 │ throw new Error(messages.ILLEGAL_NAMESPACE_VALUE);
╵ ^
How to fix it?
Expected behavior
No error
Steps to reproduce
Use build.mjs
import*asesbuildfrom'esbuild'importcopyStaticFilesfrom'esbuild-copy-static-files'importstylexPluginfrom'@stylexjs/esbuild-plugin'import{clean}from'esbuild-plugin-clean'importpathfrom'path'import{fileURLToPath}from'url'importimageminfrom'imagemin'importimageminMozjpegfrom'imagemin-mozjpeg'importimageminPngquantfrom'imagemin-pngquant'importfsfrom'fs'import{networkInterfaces}from'os'importautoprefixerfrom'autoprefixer'importtailwindcssfrom'tailwindcss'importstylePluginfrom'esbuild-style-plugin'importkonstaConfigfrom'konsta/config'importsvgrfrom'esbuild-plugin-svgr'const__dirname=path.dirname(fileURLToPath(import.meta.url))constSTYLEX_BUNDLE_PATH=path.resolve(__dirname,'..','public/stylex.css')constIS_PRODUCTION=process.env.NODE_ENV==='production'constIS_ANALYZE_ENABLED=falseconstgetLocalIpAddress=()=>{constnets=networkInterfaces()constresults=Object.create(null)// Or just '{}', an empty objectfor(constnameofObject.keys(nets))for(constnetofnets[name]){// Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses// 'IPv4' is in Node <= 17, from 18 it's a number 4 or 6constfamilyV4Value=typeofnet.family==='string' ? 'IPv4' : 4if(net.family===familyV4Value&&!net.internal){if(!results[name])results[name]=[]results[name].push(net.address)}}returnresults}constimageMinifyPlugin={name: 'image-minify',setup(build){build.onLoad({filter: /\.(png|jpg|jpeg)$/},asyncargs=>{constbuffer=awaitfs.promises.readFile(args.path)constoptimizedBuffer=awaitimagemin.buffer(buffer,{plugins: [imageminMozjpeg(),imageminPngquant(),],})return{contents: optimizedBuffer,loader: 'file'}})},}constconfig={entryPoints: ['src/app/index.tsx'],outfile: 'public/index.js',bundle: true,minify: IS_PRODUCTION,sourcemap: !IS_PRODUCTION,metafile: IS_ANALYZE_ENABLED,define: {'process.env.NODE_ENV': IS_PRODUCTION ? '"production"' : '"development"',},plugins: [clean({patterns: ['./public/*'],}),stylexPlugin({useCSSLayers: false,generatedCSSFileName: STYLEX_BUNDLE_PATH,stylexImports: ['@stylexjs/stylex'],unstable_moduleResolution: {type: 'experimental_crossFileParsing',rootDir: path.resolve(__dirname,'..'),},}),stylePlugin({postcss: {plugins: [tailwindcss(konstaConfig({content: ['./src/**/*.{js,jsx,ts,tsx}'],theme: {extend: {},},plugins: [],})),autoprefixer,],},}),svgr(),copyStaticFiles({src: 'src/static',dest: 'public',}),imageMinifyPlugin,],loader: {'.png': 'file','.svg': 'text',},target: ['chrome58','firefox57','safari11','edge18'],tsconfig: 'tsconfig.json',alias: {react: 'preact/compat','react-dom/test-utils': 'preact/test-utils','react-dom': 'preact/compat','react/jsx-runtime': 'preact/jsx-runtime',},}if(IS_PRODUCTION){constresult=awaitesbuild.build(config)if(IS_ANALYZE_ENABLED)console.log(awaitesbuild.analyzeMetafile(result.metafile,{verbose: true,}))}else{constctx=awaitesbuild.context(config)awaitctx.watch()console.log('watching...')const{ host, port }=awaitctx.serve({servedir: 'public',})console.log('serving...',`http://${host}:${port}`)console.log('local ip address: ',getLocalIpAddress())}
Please share the file /Users/kesha/projects/nano_gym_tma/src/app/styles.tsx. You're likely using some invalid way to define styles, but I cannot say for sure without looking at your code. Thanks.
Describe the issue
Hi
I have app with esbuild.
I followed guide on this page https://stylexjs.com/docs/learn/theming/using-variables/
On build example code gives error
How to fix it?
Expected behavior
No error
Steps to reproduce
Use build.mjs
And code from this page https://stylexjs.com/docs/learn/theming/using-variables/
It will give compilation error
Test case
No response
Additional comments
No response
The text was updated successfully, but these errors were encountered: