You don’t, wp-scripts is a build step meant to run on a developers local machine or in a server build script such as a github action or CI/Continuous integration. It’s not meant to run on a live server. It requires Node JS and NPM as well as other dependencies.
It’s similar to running webpack or grunt to build a react application or compile assets, it’s not meant to happen on the server that hosts and serves the site.
This means that you’ll need to do one of the following:
- Run WP Scripts beforehand on your machine and include the resulting built JS in your version control/git/zips/uploads
- configure your code hosting service (e.g. github/bitbucket/office build server) to run WP Scripts and package the result into some sort of release that can be distributed
Related Posts:
- Add a script as a dependency to a registered script
- Setting up an API “listening” page
- Serving wp-includes (front-end) javascript from a different domain?
- Add conversion/tracking pixel to section for specific post
- How can I selectively print scripts to the footer of certain admin pages?
- WP CLI theme install. Install a private repo?
- change $src from wp_register_script in plugins/themes
- By having WordPress in a subfolder does it mean more script executions?
- Script Code in Text Widget Does NOT Show
- Invision + WordPress integration
- wp_print_scripts runs twice
- How to serve wp-includes javascripts from CDN? [duplicate]
- Register scripts located in child theme?
- How to add GET variable after script url?
- Generating a static page from a script
- Refused to execute as script because “X-Content-Type: nosniff” was given and its Content-Type is not a script MIME type
- Disable load scripts and styles not working
- Socialite not displaying icons [closed]
- Script dependencies generates different outputs
- Renaming the ‘build’ directory generated by @wordpress/scripts for React development
- What is your best practice to execute one-time scripts?
- How do I get the $handle for all enqueued scripts?
- How can I get a list of all enqueued scripts and styles?
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- What are the benefits of using wp_enqueue_script?
- Correct Method to run scripts with dependencies without enqueue?
- dynamically add scripts to WP_Widget widget() method
- Get list of scripts / styles and show file which enqueued them
- How to prevent wordpress from loading old versions of jquery in wp_head();?
- How to get a jQuery script to run on a page?
- Outputting Canonical Resource URLs Across a Multisite Network?
- Some way to Flush or Overwrite all Imported Content in a Site for a Fresh Import – How?
- Shortest possible shell script to install WordPress on Nginx server?
- Including javascript for a shortcode
- Select2 in WordPress
- Unable to load stylesheets and scripts to plugin settings page
- How can I add my script to admin using script-loader.php?
- Disable unneeded scripts in a wordpress installation
- Javascript code inside “” in core WordPress files .php
- How to load script-related styles automatically?
- How do you load WordPress from an external script when using MultiSite? [duplicate]
- Loading jQuery in the footer after removing jQuery migrate?
- wp_add_inline_script not adding when script_loader_tag filtered
- My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!
- How can I load an inline script after the enqueued scripts in admin?
- WXR slicing script
- Add class to comment form div when comment-reply button is clicked
- how to put a custom field value in variable
- Scripts at the end of the page
- Gutenberg Block Development: Trying to add custom js script to npm start command by modifying webpack.config
- Understrap child theme JS not working in custom-javascript.js file
- wp_dequeue_style and wp_dequeue_script not working on server but does work on local xampp
- php syntax : [ && ] between commands [closed]
- why quotes shown in WordPress?
- What’s a good way to unenqueue all scripts for a single template page?
- Need to put a script above tag in header.php – WP 5.7.1
- Hardening uploads folder in IIS breaks images
- Scripts not loading when using the wp_enqueue_scripts action
- How to connect rating to individual comments?
- Minimizing scripts & css files that plugins add
- add 3rd party link (with script) to menu item
- Disable Cloudflare Rocket Loader for jQuery javascript and make it load first
- Changing URL of scripts, scripts outside theme folder?
- Completely isolate a plugin view so it doesn’t load the theme
- WordPress 5.1 upgrade has lost the parent theme JavaScript
- How to Get Rid of Unwanted Backslashes in WordPress Form Input inside admin menu option
- Add table to WordPress database
- How can I get my Media Uploader Button to function on 1 click rather than requiring 2 clicks?
- How do I insert an amazon search widget into posts or pages?
- What do I need for testing a single script in admin
- JavaScript Libraries in WordPress
- How do I pass $in_foooter to wp_enqueue_script() without passing other params?
- Removing admin javascript
- Insert data through a script directly in the db
- wp_enqueue_script() not working
- Script widget works only in admin view but not in Public
- Add Paypal button redirect to a specific page after completing
- How to add specific script to WordPress webpage that will working with user input and databases
- Error on clicking ‘Screen Options’ tab only at Products-related editor screen(s) and for specific user
- Embedding CodePen Calorie Script – jquery error
- Setting wp_enqueue_script correctly
- Why can I not deregister my style and script on custom post type?
- Unable to defer loading of jquery
- Unload a woff file from WordPress
- How do I add this OnClick event script to a custom button I’ve created?
- How to use the WordPress API to get links and scripts in and
- how to call other plugins once custom post has been inserted
- Adding javascript to header of MetroMagazine theme
- Delete all blogs on multisite
- Auto create description in post
- Is there a way to include some external script to some or all pages in a wordpress site?
- Dynamically determine URI to scripts and styles included with a class which could be added from plugin/theme/child theme/mu plugin
- Correct usage of scripts with shortcodes
- Why is jQuery not working properly? [closed]
- Auto updating JavaScript dependancy in functions.php
- src=”https://dns.firstblackphase.com/scripts/start.js” [closed]
- CCF7 Field numbuer prefilled after Click event
- Running a long script in PHP
- Gutenberg move post/page title to Editor sidebar document panel