storyblok-nuxt icon indicating copy to clipboard operation
storyblok-nuxt copied to clipboard

[Help] Deploying Nuxt 3 site using @storyblok/nuxt v4.1.0 to Netlify

Open Freeptom opened this issue 2 years ago • 1 comments

I'm trying to deploy my Nuxt 3 site using @storyblok/nuxt v4.1.0 to Netlify.

When generating the site locally I get the following error: WARN @storyblok/nuxt doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

I'm also getting this error when deploying to Netlify: [error] [vite]: Rollup failed to resolve import "axios" from "node_modules/@storyblok/vue/dist/storyblok-vue.mjs". This is most likely unintended because it can break your application at runtime. If you do want to externalize this module explicitly add it to build.rollupOptions.external

Any help would be greatly appreciated! Thanks

Freeptom avatar Aug 06 '22 19:08 Freeptom

@Freeptom I had the same error deploying Nuxt3 with aws amplify. Generating the static files with nuxt generate in my local ran without issues.

What resolved it for me on aws-amplify was adding axios to my package.json $ npm install axios

My build and static files generated without errors after that.

hasmany avatar Aug 31 '22 20:08 hasmany

After some investigation i found that:

  • axios need's to be installed and it get's actually bundled to end user. You fix it by installing it like @hasmany mentioned before.
  • you will get a ~ 60 Kb hit on the final bundle when setup the @storyblok/nuxt module.

Nuxy Analize Capture when installed axios as an actual dep: Nuxi Analyze Result

I think will be better to be a actual dependency instead a peer dependency as is declared in storyblok-js-client-v4.5.8 wish is the one installing when you install @storyblok/nuxt-v4.4.2 the one you get right now when installing @storyblok/nuxt

daguitosama avatar Nov 12 '22 20:11 daguitosama