Vuetify 2.4.2 破坏了 Gridsome 0.7.23 构建

问题描述

我在使用 Vuetify 构建 Gridsome 时遇到了一些问题。

根据https://gridsome.org/docs/assets-css/#vuetify,为了在Gridsome中使用Vuetify,您需要安装library(spdep) set.seed(123) xy<- cbind(rnorm(1000,100000,100),(rnorm(1000,500000,100))) Var <- rnorm(1000,2,1) autocov <- autocov_dist(Var,xy,nbs=100,style="B",type="inverse") vuetify修改

webpack-node-externals

//main.js import Vuetify from 'vuetify' import 'vuetify/dist/vuetify.min.css' import DefaultLayout from '~/layouts/Default.vue' export default function (Vue,{ appOptions,head }) { head.link.push({ rel: 'stylesheet',href: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css',}) head.link.push({ rel: 'stylesheet',href: 'https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900',}); const opts = {} //opts includes,vuetify themes,icons,etc. Vue.use(Vuetify) appOptions.vuetify = new Vuetify(opts); // Set default layout as a global component Vue.component('Layout',DefaultLayout) }

gridsome.server.js

const nodeExternals = require('webpack-node-externals') module.exports = function (api) { api.chainWebpack((config,{ isServer }) => { if (isServer) { config.externals([ nodeExternals({ allowlist: [/^vuetify/] }) ]) } }) api.loadSource(store => { // Use the Data store API here: https://gridsome.org/docs/data-store-api }) } 修改 Gridsome build 后失败,这是错误

gridsome.server.js

一切都运行得很完美,直到我修改PS E:\Dev\Projects\gridsome-vuetify-test> gridsome build Gridsome v0.7.23 Initializing plugins... Load sources - 0s Create GraphQL schema - 0.03s Create pages and templates - 0.03s Generate temporary code - 0.04s Bootstrap finish - 1.29s Compile assets - 6.72s Execute GraphQL (3 queries) - 0.01s Could not generate HTML for "/about/": Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: E:\Dev\Projects\gridsome-vuetify-test\node_modules\@babel\runtime\helpers\esm\unsupportedIterabletoArray.js require() of ES modules is not supported. require() of E:\Dev\Projects\gridsome-vuetify-test\node_modules\@babel\runtime\helpers\esm\unsupportedIterabletoArray.js from E:\Dev\Projects\gridsome-vuetify-test\node_modules\vue-server-renderer\build.prod.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename unsupportedIterabletoArray.js to end in .cjs,change the requiring code to use import(),or remove "type": "module" from E:\Dev\Projects\gridsome-vuetify-test\node_modules\@babel\runtime\helpers\esm\package.json. at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at E:\Dev\Projects\gridsome-vuetify-test\node_modules\vue-server-renderer\build.prod.js:1:77645 at Object.YbeR (webpack:/external "@babel/runtime/helpers/esm/unsupportedIterabletoArray":1:0) at __webpack_require__ (webpack/bootstrap:25:0) at Module.O/VM (assets/js/app.46242f68.js:1744:35) at __webpack_require__ (webpack/bootstrap:25:0) ,我试图环顾四周,但没有找到任何东西。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...