Closed madiyetov closed 1 year ago
Thanks, were on it!
Hi @madiyetov
I've managed to recreate this issue in outnuxt-starter-prismic-multi-page
:)
Here are the conditions required to recreate the issue.
nuxt-sm
in the package.json.sm.json
file.nuxt.config.js
Changing any one of those should fix the issue, I'll investigate further to come up with a long term solution :)
You might need to manually configure the project
add this to the nuxt.conf.js
file
{
buildModules: ["@nuxtjs/prismic"],
prismic: {
endpoint: "https://<your-repo>.cdn.prismic.io/api/v2",
modern: true
},
build: {
transpile: ["@prismicio/vue"]
}
}
Hi @madiyetov,
Are you still encountering the issue? This was resolved in the version 1.0.3.
Thanks,
Hi,
I'm closing the issue, let us know in case it re-occurs.
Thanks,
Versions
Reproduction
I've upgraded the slice-machine version to
1.0.1
from0.7.1
. When running the slice machine for the first time I get a casting error (ArrowFunctionExpression
). It's because mynuxt.config.js
file has function declaration like this:export default async () => ({})
I've changed the arrow function to this:export default async function() {return {}}
But it throwsCasting "FunctionDeclaration" is not supported
error.Error log
``` /node_modules/.pnpm/@slicemachine+manager@0.2.0_monocle-ts@2.3.13_newtype-ts@0.3.5_puppeteer@19.11.1/node_modules/@slicemachine/manager/dist/managers/project/ProjectManager.cjs:142 throw new errors.SliceMachineError(`Failed to initialize project: ${errors$1.join(", ")}`); ^ SliceMachineError: Failed to initialize project: Error: Error in `@slicemachine/adapter-nuxt2` during `project:init` hook: Casting "ArrowFunctionExpression" is not supported at ProjectManager.initProject (/node_modules/.pnpm/@slicemachine+manager@0.2.0_monocle-ts@2.3.13_newtype-ts@0.3.5_puppeteer@19.11.1/node_modules/@slicemachine/manager/dist/managers/project/ProjectManager.cjs:142:13) at async Module.migrateSMJSON (/node_modules/.pnpm/start-slicemachine@0.7.1_monocle-ts@2.3.13_newtype-ts@0.3.5_puppeteer@19.11.1/node_modules/start-slicemachine/dist/legacyMigrations/migrateSMJSON.cjs:109:5) at async StartSliceMachineProcess.run (/node_modules/.pnpm/start-slicemachine@0.7.1_monocle-ts@2.3.13_newtype-ts@0.3.5_puppeteer@19.11.1/node_modules/start-slicemachine/dist/StartSliceMachineProcess.cjs:49:5) { _sliceMachineError: true } ``` Node.js v18.12.1
Steps to reproduce
Create a Nuxt project with
nuxt.config.js
has an arrow function declaration and with Slice Machine v0.7.1. And upgrade it to v1.0.1.What is expected?
Change the codebase to use the new slice machine version
What is actually happening?
It is failing