Babel exclusively processes JavaScript files in my Vue project, rather than the project as a whole

I need to make my Vue project compatible with an old iPad running iOS/safari version 5, which requires transpiling it to ES5 using Babel.

Here is the content of my babel.config.js:

  presets: [
    //'@vue/cli-plugin-babel/preset',
    ["@babel/env",
    {
      targets: {
        safari: "5",
        ios: "5",
      },
      useBuiltIns: "usage",
      "corejs": "3.6.4",
    },]
  ]
}

When I run npx babel src --out-dir dist, only the .js files are compiled into the dist folder. The .vue files, static assets, and html files are not included in the compilation process.

How can I configure Babel to compile all file types, and are there any additional steps required to successfully transpile my project to ES5?

Below is the information from my package.json:

{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@babel/polyfill": "^7.12.1",
    "axios": "^0.20.0",
    "core-js": "^3.6.5",
    "sass": "^1.27.0",
    "sass-loader": "^10.0.3",
    "vue": "^2.6.11",
    "vue-axios": "^2.1.5",
    "vue-device-detector": "^1.1.6",
    "vue-material": "^1.0.0-beta-15",
    "vue-router": "^3.2.0",
    "vuelidate": "^0.7.5"
  },
  "devDependencies": {
    "@babel/cli": "^7.12.1",
    "@babel/core": "^7.12.3",
    "@babel/preset-env": "^7.12.1",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  }
}

Answer №1

Babel is not designed to compile static assets; instead, use a bundler such as webpack or a task runner like Gulp for this specific task.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Update the src attribute in an HTML document

I am looking to dynamically change the size of an image on an HTML page using a dropdown list. Here is my code: <html> <head> </head> <body> <select id="selectbox" name=""> <opti ...

The issue arises when nuxt.js is set to spa mode and the root path is not correctly configured on a

English is not my strong suit, apologies in advance. I have a Nuxt project set up like this. Operating in spa mode. Folder Structure pages - index.vue index |_ child.vue |_ index.vue pages/index.vue <template> < ...

Clouds marred by a unpleasant visual presentation

I've been following the instructions on this specific tutorial, but I'm attempting to scale it up significantly (increasing the radius to 100000 units). It seems like the size may be affecting the outcome, as the clouds in my earth render are ap ...

AngularJS: The art of object pushing

I have a small application where I need to read data from a JSON file, display it, and allow users to add records to it. Specifically, I have an array called condition within the patient object, and I want to insert a new item into this array based on user ...

UI-Router - templateUrl: "Ensure the content is securely delivered via HTTPS"

I am currently using HTTPS for my website. I have a requirement to send a request for templateUrl, not to a static file, but to the router: /:lang/content/library/book/:bookId Below is the setup for my state: .state('book', { url: '/ ...

What are the steps to run and test the renovate bot on your local machine

Before setting up renovate to work with my Azure pipeline, I wanted to test it locally using npx renovate to ensure everything is working as expected and that my config file is properly configured. I ran npx renovate --platform local command. My project i ...

Laravel route does not receive a parameter sent via Ajax

I am currently using Laravel 5.8 and implementing a discount code system on my website. To achieve this, I attempted to send data via Ajax in the following manner: $.ajax({ type: 'POST', url: baseurl + 'discount/register', ...

Ways to troubleshoot when IntelliJ can't locate the Node interpreter even though the node file is present within the folder

I'm having trouble with Intellij not recognizing my Node.js installation. Even though the node file is visible in my file manager, it's not showing up locally within Intellij. I'm using Fedora 29 and can run Node.js in my terminal, so I know ...

JavaScript call is not appearing during execution on asp.net

In the aspx page, there is an input element that looks like this: <input id="txtAllocAmt" type="text" class="txtAllocAmt" tabindex="2" size="10" name="Text1" runat="server" disabled="disabled" onfocus="javascript:SetOldAllocAmt(t ...

Learning how to replace the alert function with Bootbox

I am currently working on a form that posts to a MySQL database. I want to replace the alert function triggered by the Malsup jQuery Form Plugin with the one created by the Bootbox plugin. Even though both plugins are functional, I struggle to integrate th ...

Is it possible for us to upload a directory called "node_modules" to the npm

Is there a way to push a package to npm while including the existing node_modules folder? Whenever I try to publish the package, the node_modules folder doesn't get included. Does anyone have any tips on how to achieve this? ...

Stop Carousel when hovering over individual items (Owl Beta 2)

After creating a unique navigation that is separate from the carousel, I encountered some issues with the autoplay feature. Below is the HTML markup: <div class="carousel"> <div class=""> <img src="assets/img/carousel1.jpg" /&g ...

Defining data types for an array of objects in a useState hook

I'm having trouble understanding the issue with my code. interface dataHistory { data: string, before: string | number, after: string | number, } I have an interface defined outside of the Functional Component and inside I specify its struct ...

JavaScript function to provide a range of numbers based on a specified number and step value

I am looking for a solution to dynamically generate content based on the number of slides/steps using JavaScript. Any suggestions on how to best achieve this? Thanks in advance! switch(this.currentSlide) { case 1: return '1-12'; ...

A Bluebird promise was generated within a NodeJS handler function, however it was not properly returned from the function

Below is the nodejs code for an express middleware function: Middleware.is_authenticated = function(req, res, next) { if(req.system_session == undefined || req.system_session.login_status == false) return res.status(401).send({errors: true, error: &ap ...

Prevent additional clicks on the image

Currently, I am dealing with a situation where I have a list containing a jQuery handler for mouse clicks. The dilemma is that I need to insert an image into the list, but I want clicking on the image to trigger a different function than clicking elsewhere ...

"Encountering issues with CSRF token validation in an Angular SpringBoot application when making an Ajax POST request, resulting in an

Current Project Details The ongoing project involves developing a single-page Angular JS application using SpringBoot with a Spring Security implementation. The application, known as 'Study Planner', allows students to input their study leave on ...

Utilizing a callback within a conditional statement in VueJS: A step-by-step guide

Trying to customize focus styling in vueJS has been a challenge for me. I found a function that identifies the focused element, but integrating it into conditional rendering proved difficult. As a workaround, I attempted to use a callback, but I'm str ...

Issue with HTML dropdown functionality

I’m facing an issue with my dropdown menu. Clicking on a button should toggle the dropdown menu, showing it if closed and hiding it if open. However, the dropdown menu does not close when I click the button again. I suspect the problem lies with the clos ...

Automatically trigger a page reload using a jQuery function

Currently facing an issue with jQuery. I created a drop-down menu and would like it to expand when the li tag within the menu is clicked. Even though I am using the jQuery click function successfully, there seems to be a problem where the webpage refreshe ...