Open aimeb1 opened 12 months ago
Making this change to index.js appears to fix the issue:
// const projectLocalThemeDir = this.options.buildDir.replace('.nuxt', targetDirectory);
const path = require('path');
const projectLocalThemeDir = path.join(this.options.rootDir, path.sep + targetDirectory);
Environment
OS: Windows-WSL2-Ubuntu 22.04 Node: 14.17 Docker Image: FROM mcr.microsoft.com/devcontainers/javascript-node:14 Project Version: V1.5.0 https://github.com/vuestorefront-community/spree Package Manager: yarn Builders: webpack,babel,rollup
User Config:
target: 'static', // ssr: true,
buildModules: [ ['@vue-storefront/nuxt-theme', { routes: false, generate: { replace: { apiClient: '@vue-storefront/spree-api', composables: '@vue-storefront/spree' } } }]
router: {
},
generate: { crawler: false, routes: ['/HomePre'] }
Runtime Modules: @vue-storefront/nuxt nuxt-i18n cookie-universal-nuxt vue-scrollto/nuxt @vue-storefront/middleware/nuxt
Build Modules: @nuxtjs/composition-api/module @nuxt/typescript-build @nuxtjs/google-fonts nuxtjs/pwa @nuxtjs/style-resources @vue-storefront/spree/nuxt @vue-storefront/nuxt @vue-storefront/nuxt-theme
Reproduction
Using V1.5.0 from V1.5.0 https://github.com/vuestorefront-community/spree along with nuxt config changes above. I modified root package.json scripts to include a generate command:
"scripts": { "generate": "yarn build:api-client && yarn build:composables && yarn generate:theme", "generate:theme": "cd packages/theme && yarn generate",
I run 'yarn generate' and get the following in the log which seems 'ok' except maybe for the warning that @vue-storefront/nuxt should only be specified once (it is included in both the Modules and Build Modules).
ℹ VSF Starting Vue Storefront Nuxt Module 16:20:29 ✔ VSF Installed Vue Storefront Context plugin 16:20:29 ✔ VSF Installed Vue Storefront SSR plugin 16:20:29 ✔ VSF Installed VSF Logger plugin 16:20:29 ✔ VSF Installed Vue Storefront E2E testing plugin 16:20:29 ✔ VSF Installed Internationalization Cookies plugin 16:20:29 ✔ VSF Installed StorefrontUI Module 16:20:29 ✔ VSF Installed Performance Module 16:20:29 ℹ VSF Using raw source/ESM for @vue-storefront/spree 16:20:29 ℹ VSF Using raw source/ESM for @vue-storefront/core 16:20:29 ℹ VSF Using raw source/ESM for @storefront-ui/vue 16:20:29 ℹ VSF Using raw source/ESM for @storefront-ui/shared 16:20:29 ℹ VSF Starting Theme Module 16:20:29 ℹ VSF Watching changes in @vue-storefront/nuxt-theme-module and used platform theme directory ℹ VSF Adding theme files... 16:20:29
WARN Modules should be only specified once: @vue-storefront/nuxt 16:20:29
ℹ VSF Starting Vue Storefront Nuxt Module 16:20:29 ✔ VSF Installed Vue Storefront Context plugin 16:20:29 ✔ VSF Installed Vue Storefront SSR plugin 16:20:29 ✔ VSF Installed VSF Logger plugin 16:20:29 ✔ VSF Installed Vue Storefront E2E testing plugin 16:20:29 ✔ VSF Installed Internationalization Cookies plugin 16:20:29 ✔ VSF Installed StorefrontUI Module 16:20:29 ✔ VSF Installed Performance Module 16:20:29 ℹ VSF Using raw source/ESM for @storefront-ui/vue 16:20:29 ℹ VSF Using raw source/ESM for @storefront-ui/shared 16:20:29 ✔ VSF Added 58 theme file(s) to _theme folder 16:20:29 ℹ Middleware starting.... 16:20:30 ℹ Loading integrations... 16:20:30 ℹ - Loading: spree @vue-storefront/spree-api/server 16:20:30 ✔ - Integration: spree init function Start! 16:20:30 ✔ - Integration: spree init function Done! 16:20:30 ℹ - Loading: spree extension: tokenExtension 16:20:30 ✔ - Integration: spree loaded! 16:20:30 ✔ Integrations loaded! 16:20:30 ✔ Middleware created! 16:20:30 ℹ Production build 16:20:31 ℹ Bundling for server and client side 16:20:31 ℹ Target: static 16:20:31 ✔ Builder initialized 16:20:31 ✔ Nuxt files generated 16:20:32
Describe the bug
The errors in the console come during the build step of the yarn generate command. I included only the 1st 'Module not found' error in the log below although there are many others.
Additional context
After some debugging I noticed the error seems to come down to a bad definition of the ~ alias. The imports in the default.vue layout references this alias: import AppFooter from '~/components/AppFooter.vue';
The generate.js file from @vue-storefront/nuxt-theme defines these aliases:
However, the projectLocalThemeDir variable has a value of: "/app/packages/theme/node_modules/.cache/nuxt"
This directory does not contain the AppFooter.vue. Shouldn't this variable be set to: "/app/packages/theme"?
Logs