Share page:
Wix Backend is Changing - everything you need to know about the new .web.js files
The Wix Wiz
Feb 23, 2024
9
Tags:
Web tools, Database, VELO, Developments, Speed site, Code
Timeline:
00:25 Transition from .jsw to .web.js
01:57 Understanding backend code in Wix
02:49 Transition timeline
03:04 Example of old .jsw file function
04:01 Importance of backend operations
04:41 Managing permissions in backend files
05:49 Permission error demonstration
06:32 Adjusting permissions
07:56 Introduction to .web.js files
08:50 Defining permissions in .web.js
09:57 Converting function to .web.js format
11:11 Permission error on live site
12:47 Reason for the transition to .web.js
14:59 Limitations of web method permissions
16:18 Conclusion and final thoughts
The .web.js file extension typically indicates a JavaScript file that is intended for web development purposes. Here's what you need to know about these files:
Purpose: .web.js files are commonly used in web development projects, particularly in setups involving tools like React, Next.js, or other frameworks that support modular code organization.
File Structure: Like regular JavaScript files, .web.js files contain JavaScript code. They can include functions, variables, imports, exports, and any other JavaScript constructs.
Platform Agnostic: The .web.js extension is often used to indicate that the JavaScript code within the file is meant to be platform-agnostic, meaning it can run in both web browsers and other environments like Node.js.
Polyfilling and Compatibility: Developers might use .web.js files to provide polyfills or compatibility layers for web-specific features or APIs. These files may contain code that ensures consistent behavior across different web browsers or implements features not natively supported in certain environments.
Webpack and Module Bundlers: In projects using module bundlers like Webpack, .web.js files can be configured to serve as platform-specific entry points or aliases. This allows developers to write code that adapts based on the target platform.
Deployment and Optimization: During the build process, .web.js files may undergo transformations or optimizations specific to web deployment. This could include minification, tree shaking, code splitting, or other techniques aimed at improving performance and reducing bundle size for web delivery.
Naming Convention: While .web.js is a common convention, some projects may use different naming schemes for similar purposes, such as .client.js, .browser.js, or .web.* (e.g., .web.mjs for ECMAScript Modules).
Documentation and Guidelines: If you encounter .web.js files in a project, it's essential to consult the project's documentation or guidelines. Understanding how these files are used within the specific project context can help you effectively contribute to or work with the codebase.
Overall, .web.js files serve as a mechanism for organizing and managing JavaScript code in web development projects, particularly in scenarios where platform-agnostic or web-specific functionality is required.