我将nuxt.js与Vue一起使用
我在以构建方式运行项目时遇到问题(npm run build)。在开发模式下,项目开始(npm run dev-> 0错误,并且localhost:3000运行)
我尝试删除.nuxt文件夹,节点模块和锁定文件,尝试使用yarn和npm,我尝试了不同的选项-一个结果
当我尝试“ npm run build”时,。/ node_modules / bootstrap-vue / src /中有41个错误。
ERROR Failed to compile with 41 errors 22:48:24
error in ./node_modules/bootstrap-vue/src/components/layout/col.js
Module parse failed: Unexpected token (100:4)
You may need an appropriate loader to handle this file type.
| cols: strNum(),
| // Breakpoint Specific props
| ...breakpointCol,
| offset: strNum(),
| ...breakpointOffset,
@ ./node_modules/bootstrap-vue/src/components/layout/index.js 3:0-24
@ ./node_modules/bootstrap-vue/src/components/index.js
@ ./node_modules/bootstrap-vue/src/index.js
@ ./.nuxt/bootstrap-vue.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
error in ./node_modules/bootstrap-vue/src/components/toast/helpers/bv-toast.js
Module parse failed: Unexpected token (107:6)
You may need an appropriate loader to handle this file type.
| // Preset the prop values
| propsData: {
| ...filterOptions(getComponentConfig('BToast') || {}),
| // Add in (filtered) user supplied props
| ...omit(props, ['toastContent']),
@ ./node_modules/bootstrap-vue/src/components/toast/index.js 3:0-47
@ ./node_modules/bootstrap-vue/src/components/index.js
@ ./node_modules/bootstrap-vue/src/index.js
@ ./.nuxt/bootstrap-vue.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
我的nuxt.config.js
module.exports = {
mode: "spa",
head: {
title: "nuxt-template",
meta: [ { charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "description", name: "description", content: "Nuxt.js project" } ],
link: [ { rel: "icon", type: "image/x-icon", href: "/favicon.ico" } ],
script: [ { src: "/js/signalr.js" } ]
},
css: ["~assets/scss/coreui.scss"],
loading: {
color: "#3B8070"
},
plugins: ["~/plugins/bootstrap-vue", "~/plugins/vue-notifications", "~/plugins/mixin", "~/plugins/vue-tables-2", "~/plugins/moment.js", "~/plugins/vue-text-mask.js", "~/plugins/vue-clipboard2.js"],
build: {
analyze: true,
vendor: ["axios", "bootstrap-vue", "vue-notifications", "mini-toastr", "js-cookie", "jwt-decode", "vuelidate", "vue-tables-2", "moment", "vue-text-mask", "vue-select", "vue-clipboard2", "vue-qrcode-component"],
extend(config, { isDev, isClient }) {
if (isClient) {
config.devtool = "eval-source-map";
}
if (isDev && isClient) {
config.module.rules.push({
enforce: "pre",
test: /\.(js|vue)$/,
loader: "eslint-loader",
exclude: /(node_modules)/
});
}
}
},
modules: [ [ "bootstrap-vue/nuxt", { css: false } ] ]
};
它要求什么处理程序来处理这种类型的文件?如何添加适当的加载器来处理此文件类型?