To set up Nuxt 2.8 to produce code that is compatible with ES5, you need to follow these steps:
Install the @nuxtjs/eslint-config
package as a development dependency by running the following command in your terminal:
npm install --save-dev @nuxtjs/eslint-config
Create a .eslintrc.js
file in your project directory with the following content:
module.exports = {
extends: [
'@nuxtjs',
'eslint:recommended',
'plugin:vue/recommended',
'prettier',
'prettier/vue',
],
rules: {
'vue/no-v-html': 'off',
},
}
This configures ESLint to use the Nuxt.js recommended config and Prettier formatting.
Add a Babel configuration by creating a .babelrc
file with the following content:
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"ie": "11",
"chrome": "58",
"safari": "10",
"firefox": "54",
"edge": "14"
},
"useBuiltIns": "usage",
"corejs": "3.6.5"
}
]
]
}
This tells Babel to target a specific set of browsers and to use the usage
option for the core-js
polyfills.
Finally, update your nuxt.config.js
file to include the @nuxtjs/eslint-config
module:
export default {
buildModules: [
'@nuxtjs/eslint-config'
],
build: {
babel: {
presets({ isServer }) {
const targets = isServer ? { node: 'current' } : { ie: '11' }
return [
[
'@nuxt/babel-preset-app',
{
loose: true,
targets,
},
],
]
},
},
},
// ...
}
This configures your project to use the @nuxtjs/eslint-config
module during the build process.
With these changes, you should be able to produce code that is compatible with ES5 when using Nuxt.js 2.8.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-14 20:18:02 +0000
Seen: 8 times
Last updated: Jun 14 '23
What is the process for altering svn branches with git-svn?
What is the process to italicize certain keywords in visual studio code?
What is the process for developing a JTable that has both row and column headers?
What is the process for removing a dat.GUI element?
How to solve the issue "process is running" in Visual Studio Debugging?
What is the process of moving information from one tab to another in Excel by transposing it?
What is the process of dividing the WSD dataset (in CSV format) into tokens called?
What is the process of uploading a file using NextJS and formidable?
What is the process for using pnpm to build a single workspace only?