vite-ssg
vite-ssg copied to clipboard
SSG Builds broken - Need quick help configuring builds
I recently added some new packages/code to my vite-ssg project (using vitesse). All build modes were working without issue until the addition of this new code + npm packages. I had working vite builds + working SSG builds.
Now, I am able to build with cross-env NODE_ENV=production vite build but cannot build with cross-env NODE_ENV=production vite-ssg build
I'm going to guess that there are some changes I need to make to my vite config and/or to SSG, but I'm stuck. Any help would be much appreciated! :)
Error trace
[vite-ssg] Build for server...
vite v2.4.4 building SSR bundle for production...
✓ 573 modules transformed.
.vite-ssg-temp/manifest.webmanifest 0.37kb
.vite-ssg-temp/assets/style.c59dba99.css 244.38kb
.vite-ssg-temp/main.js 634.65kb
/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aws-amplify/ui-components/dist/components/index.js:1
(function (exports, require, module, __filename, __dirname) { import { attachShadow, h, Host, createEvent, proxyCustomElement } from '@stencil/core/internal/client';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at new Script (node:vm:100:7)
at p._moduleCompile (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:3154)
at Module.o._compile (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:2705)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at n (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:2472)
at Module.<anonymous> (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/.vite-ssg-temp/main.js:22:13)
at Module.o._compile (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:2778)
/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client:
ERROR @testProjtestProj/[email protected] build:ssg: `cross-env NODE_ENV=production vite-ssg build`
Exit status 1
ERROR Command failed with exit code 1.
Full build logs
╰─ pnpm build:client:pnpm:ssg
> [email protected] build:client:pnpm:ssg /Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2
> pnpm run build:ssg --filter @testProjtestProj/client
> @testProjtestProj/[email protected] build:ssg /Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client
> cross-env NODE_ENV=production vite-ssg build
[vite-ssg] Build for client...
vite v2.4.4 building for production...
✓ 2185 modules transformed.
dist/assets/color.473bc8ca.png 10.11kb
dist/assets/primeicons.7362b83d.eot 56.21kb
dist/assets/primeicons.c1e93246.ttf 56.04kb
dist/assets/primeicons.3929b551.woff 56.11kb
dist/assets/primeicons.8f9d2aaf.svg 229.14kb
dist/index.html 1.36kb
dist/manifest.webmanifest 0.37kb
dist/ssr-manifest.json 346.73kb
dist/assets/virtual_pwa-register.ecd604b6.js 5.44kb / brotli: 1.98kb
dist/assets/signin.5f646ef8.js 5.79kb / brotli: 1.84kb
dist/assets/x.7978b5aa.js 0.47kb / brotli: 0.29kb
dist/assets/landingtwo.d40769b6.js 7.74kb / brotli: 2.37kb
dist/assets/dicom-overlay.af56634f.js 0.63kb / brotli: 0.33kb
dist/assets/home.e25fc82f.js 9.81kb / brotli: 3.57kb
dist/assets/mail.3f6051bf.js 0.55kb / brotli: 0.33kb
dist/assets/calendar.c651f22a.js 0.77kb / brotli: 0.41kb
dist/assets/about.ccc1ce3a.js 1.79kb / brotli: 0.60kb
dist/assets/README.c331fb6e.js 1.22kb / brotli: 0.43kb
dist/assets/[name].800cb756.js 1.34kb / brotli: 0.72kb
dist/assets/landingone.6e27b29d.js 19.23kb / brotli: 4.38kb
dist/assets/[...all].4d5e4be5.js 0.22kb / brotli: 0.16kb
dist/assets/directory.e153bbc9.js 20.11kb / brotli: 4.23kb
dist/assets/404.c02b86e9.js 1.70kb / brotli: 0.74kb
dist/assets/[name].0c88a31b.js 8.26kb / brotli: 2.56kb
dist/assets/home.50d47f73.js 12.31kb / brotli: 2.86kb
dist/assets/dom.29d9f284.js 18.14kb / brotli: 4.84kb
dist/assets/signin.12fef205.css 0.36kb / brotli: 0.17kb
dist/assets/app.c6727523.js 49.99kb / brotli: 10.95kb
dist/assets/core-js.892b7ba3.js 77.26kb / brotli: 22.19kb
dist/assets/app.bd2aea20.css 208.54kb / brotli: 23.86kb
dist/assets/vendor.cb864961.js 924.80kb / brotli: skipped (large chunk)
(!) Some chunks are larger than 500kb after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
[vite-ssg] Build for server...
vite v2.4.4 building SSR bundle for production...
✓ 573 modules transformed.
.vite-ssg-temp/manifest.webmanifest 0.37kb
.vite-ssg-temp/assets/style.c59dba99.css 244.38kb
.vite-ssg-temp/main.js 634.65kb
/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/@[email protected][email protected]/node_modules/@aws-amplify/ui-components/dist/components/index.js:1
(function (exports, require, module, __filename, __dirname) { import { attachShadow, h, Host, createEvent, proxyCustomElement } from '@stencil/core/internal/client';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at new Script (node:vm:100:7)
at p._moduleCompile (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:3154)
at Module.o._compile (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:2705)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at n (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:2472)
at Module.<anonymous> (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/.vite-ssg-temp/main.js:22:13)
at Module.o._compile (/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/v8cache.js:2:2778)
/Users/armenr/Development/testProj-testProj-workspace/testProj-vitesse-test-2/packages/client:
ERROR @testProjtestProj/[email protected] build:ssg: `cross-env NODE_ENV=production vite-ssg build`
Exit status 1
ERROR Command failed with exit code 1.
The code
src/modules/Amplify.ts
import Amplify from 'aws-amplify'
import { applyPolyfills } from '@aws-amplify/ui-components/loader'
import { defineCustomElements } from '@aws-amplify/ui-components/dist/components/index'
// @ts-expect-error missing types
import awsmobile from './../aws-exports'
import { UserModule } from '~/types'
export const install: UserModule = async({ app }) => {
// app.config.globalProperties.$amplifyAuthRequiredFields = amplifyAuthRequiredFields
await Amplify.configure(awsmobile)
await applyPolyfills()
await defineCustomElements(window)
app.config.compilerOptions.isCustomElement = tag => tag.startsWith('amplify-')
}
Can you share the reproduction?
@antfu - https://github.com/armenr/amplify-vitesse-repro
pnpm i
pnpm build
Modified files:
- vite config
- components/Authwrapper.vue
- pages/index.vue
- package.json (rollup plugin, zen-observable, amplify libs, package resolution override)
@antfu - just a gentle ping...Still haven't been able to work this out, but if it's not the SSG library's issue, I'm happy to close this as being outside of this repo's/library's scope.
@armenr I clone the repo a few days ago, and I cannot just build it: I have a 9900K with 64GB of ram and a SSD 970 PRO and just running the build command I must cancel it while compiling the 817 module, never stops/finish after 10min waiting...
@userquin it builds with vite build no problem.
I think there might be something with your environment...
It builds on my Intel 16" MacBook Pro, as well as on an m1 pro, as well as in a docker container on AWS Codebuild, in Windows on an AMD, and also circleCI.
@armenr Build with this script 😅:
"build:vite": "cross-env NODE_ENV=production vite build --debug",
The build stops here, seems something blocking while processing css but other builds stop in another modules:
vite v2.4.4 building for production...
transforming (779) node_modules\.pnpm\[email protected]\node_modules\fast-xml-parser\src\validator.js vite:resolve 0ms ./markdown.css -> F:/work/projects/quini/GitHub/amplify-vitesse-repro/src/styles/mar
kdown.css +0ms
vite:resolve 2ms prism-theme-vars/base.css -> F:/work/projects/quini/GitHub/amplify-vitesse-repro/node_modules/.pnpm/[email protected]/node_modules/prism-theme-vars/base.css +14ms
transforming (820) src\styles\main.css

@armenr I found this https://discord.com/channels/804011606160703521/804440184875122730/872708020612759593 maybe related?
Totally clean git clone/ pnpm install / build - works fine (on my Mac). Also works in AWS CodeBuild/Docker build in remote environment (Linux)
Git clone + PNPM Install
╭─ armenr ~/Dev/bee/testerton ✔ 10019 09:20:16
├─
╰─ git clone https://github.com/armenr/amplify-vitesse-repro.git
Cloning into 'amplify-vitesse-repro'...
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 87 (delta 9), reused 81 (delta 6), pack-reused 0
Receiving objects: 100% (87/87), 127.14 KiB | 1.77 MiB/s, done.
Resolving deltas: 100% (9/9), done.
╭─ armenr ~/Dev/bee/testerton ✔ 10020 09:20:19
├─
╰─ cd amplify-vitesse-repro
╭─ armenr ~/Dev/bee/tes/amplify-vitesse-repro ✔ 10021 09:20:21
├─ main
╰─ pnpm i
Lockfile is up-to-date, resolution step is skipped
Packages: +995
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /Users/armenr/.pnpm-store/v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 995, reused 995, downloaded 0, added 995, done
node_modules/.pnpm/[email protected]/node_modules/ejs: Running postinstall script, done in 58ms
node_modules/.pnpm/[email protected][email protected]/node_modules/vue-demi: Running postinstall script, done in 106ms
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 262ms
dependencies:
+ @aws-amplify/ui-components 1.7.1
+ @stencil/core 2.6.0
+ @vueuse/core 5.2.0
+ @vueuse/head 0.6.0
+ aws-amplify 4.2.2
+ nprogress 0.2.0
+ prism-theme-vars 0.2.2
+ vue 3.1.5
+ vue-demi 0.11.2
+ vue-global-api 0.4.1
+ vue-i18n 9.1.7
+ vue-router 4.0.10
+ zen-observable 0.8.15
devDependencies:
+ @antfu/eslint-config 0.7.0
+ @iconify/json 1.1.381
+ @intlify/vite-plugin-vue-i18n 2.4.0
+ @rollup/plugin-node-resolve 13.0.4
+ @types/nprogress 0.2.0
+ @typescript-eslint/eslint-plugin 4.28.5
+ @vitejs/plugin-vue 1.3.0
+ @vue/compiler-sfc 3.1.5
+ @vue/server-renderer 3.1.5
+ critters 0.0.10
+ cross-env 7.0.3
+ eslint 7.32.0
+ https-localhost 4.6.5
+ markdown-it-link-attributes 3.0.0
+ markdown-it-prism 2.1.8
+ pnpm 6.11.5
+ typescript 4.3.5
+ vite 2.4.4
+ vite-plugin-components 0.13.2
+ vite-plugin-icons 0.6.5
+ vite-plugin-md 0.10.0
+ vite-plugin-pages 0.15.1
+ vite-plugin-pwa 0.9.3
+ vite-plugin-vue-layouts 0.3.1
+ vite-plugin-windicss 1.2.7
+ vite-ssg 0.14.5
+ vue-tsc 0.2.2
Build with cross-env NODE_ENV=production vite build --debug
╭─ armenr ~/Dev/bee/tes/amplify-vitesse-repro ✔ 10025 09:22:03
├─ main
╰─ pnpm build:vanilla
> @ build:vanilla /Users/armenr/Development/beep-beep-workspace/testerton/amplify-vitesse-repro
> cross-env NODE_ENV=production vite build --debug
vite:config bundled config file loaded in 1583ms +0ms
vite:config using resolved config: {
vite:config resolve: {
vite:config dedupe: undefined,
vite:config alias: [ [Object], [Object], [Object], [Object] ]
vite:config },
vite:config plugins: [
vite:config 'alias',
vite:config 'vite-plugin-pages',
vite:config 'vite-plugin-layouts',
vite:config 'vite-plugin-windicss:alias',
vite:config 'vite-plugin-windicss:groups',
vite:config 'vite-plugin-md',
vite:config 'vite:dynamic-import-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'node-resolve',
vite:config 'vite:vue',
vite:config 'vite-plugin-windicss',
vite:config 'vite-plugin-windicss:css',
vite:config 'vite-plugin-windicss:css:svelte',
vite:config 'vite-plugin-windicss:devtools',
vite:config 'vite-plugin-pwa:virtual',
vite:config 'vite-plugin-vue-i18n',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'rollup-plugin-dynamic-import-variables',
vite:config 'asset-import-meta-url',
vite:config 'vite-plugin-components',
vite:config 'vite-plugin-icons',
vite:config 'vite-plugin-windicss:entry',
vite:config 'vite-plugin-pwa',
vite:config 'vite:import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter',
vite:config 'load-fallback'
vite:config ],
vite:config server: { fs: { strict: true, allow: [Array] } },
vite:config ssgOptions: { script: 'async', formatting: 'minify' },
vite:config optimizeDeps: {
vite:config include: [ 'vue', 'vue-router', '@vueuse/core' ],
vite:config exclude: [ 'vue-demi' ],
vite:config esbuildOptions: { keepNames: undefined }
vite:config },
vite:config build: {
vite:config target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
vite:config polyfillDynamicImport: false,
vite:config outDir: 'dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: true,
vite:config sourcemap: false,
vite:config rollupOptions: {},
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
vite:config minify: 'terser',
vite:config terserOptions: {},
vite:config cleanCssOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config manifest: false,
vite:config lib: false,
vite:config ssr: false,
vite:config ssrManifest: false,
vite:config brotliSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null
vite:config },
vite:config define: {
vite:config __VUE_OPTIONS_API__: true,
vite:config __VUE_PROD_DEVTOOLS__: false,
vite:config __VUE_I18N_LEGACY_API__: false,
vite:config __VUE_I18N_FULL_INSTALL__: true,
vite:config __VUE_I18N_PROD_DEVTOOLS__: false
vite:config },
vite:config ssr: { external: [ 'vue', '@vue/server-renderer' ] },
vite:config configFile: '/Users/armenr/Development/beep-beep-workspace/testerton/amplify-vitesse-repro/vite.config.ts',
vite:config configFileDependencies: [ 'vite.config.ts' ],
vite:config inlineConfig: {
vite:config root: undefined,
vite:config base: undefined,
vite:config mode: undefined,
vite:config configFile: undefined,
vite:config logLevel: undefined,
vite:config clearScreen: undefined,
vite:config build: {}
vite:config },
vite:config root: '/Users/armenr/Development/beep-beep-workspace/testerton/amplify-vitesse-repro',
vite:config base: '/',
vite:config publicDir: '/Users/armenr/Development/beep-beep-workspace/testerton/amplify-vitesse-repro/public',
vite:config cacheDir: '/Users/armenr/Development/beep-beep-workspace/testerton/amplify-vitesse-repro/node_modules/.vite',
vite:config command: 'build',
vite:config mode: 'production',
vite:config isProduction: true,
vite:config env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
vite:config assetsInclude: [Function: assetsInclude],
vite:config logger: {
vite:config hasWarned: false,
vite:config info: [Function: info],
vite:config warn: [Function: warn],
vite:config warnOnce: [Function: warnOnce],
vite:config error: [Function: error],
vite:config clearScreen: [Function: clearScreen]
vite:config },
vite:config createResolver: [Function: createResolver]
vite:config } +244ms
vite v2.4.4 building for production...
transforming (815) ../../../../../../@windicss/devtools vite:resolve 0ms ./markdown.css -> /Users/armenr/Development/beep-beep-workspace/testerton/amplify-vitesse-repro/src/styles/markdown.css +0ms
vite:resolve 2ms prism-theme-vars/base.css -> /Users/armenr/Development/beep-beep-workspace/testerton/amplify-vitesse-repro/node_modules/.pnpm/[email protected]/node_modules/prism-theme-vars/base.css +6ms
✓ 822 modules transformed.
dist/index.html 1.08kb
dist/manifest.webmanifest 0.38kb
dist/assets/README.185fca9d.js 1.21kb / brotli: 0.43kb
dist/assets/about.e1afbdb1.js 1.77kb / brotli: 0.58kb
dist/assets/[...all].11ac864f.js 0.21kb / brotli: 0.16kb
dist/assets/[name].354f505a.js 1.31kb / brotli: 0.68kb
dist/assets/404.4e8f7a76.js 1.02kb / brotli: 0.52kb
dist/assets/home.f9f2323a.js 0.37kb / brotli: 0.23kb
dist/assets/virtual_pwa-register.95b5bcec.js 5.44kb / brotli: 1.98kb
dist/assets/dom.29d9f284.js 18.14kb / brotli: 4.84kb
dist/assets/index.30ac9cff.css 18.42kb / brotli: 3.83kb
dist/assets/index.c9f1958a.js 20.54kb / brotli: 5.36kb
dist/assets/core-js.65b1c8bc.js 77.25kb / brotli: 22.26kb
dist/assets/vendor.4d1b1fda.js 791.67kb / brotli: skipped (large chunk)
(!) Some chunks are larger than 500kb after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
hey guys thanks for everything
I'm in the same situation.
I cloned vitesse and just added @vueuse/firebase and firebase.
So when I run pnpm build it is freezing in [vite-ssg] Build finished.
I noticed that when I remove firebase import, the build works correctly and doesn't freeze.
import firebase from 'firebase/app'
import 'firebase/firestore'
import { useFirestore } from '@vueuse/firebase/useFirestore'
I tried the build on my computer (linux), Vercel and Netlify.
I have problems with vite-ssg and firebase too. I clone vitesse and add a file at ~/composables/products.ts
import firebase from 'firebase/compat/app'
import 'firebase/compat/firestore'
import { useFirestore } from '@vueuse/firebase/useFirestore'
const firebaseConfig = {
apiKey: import.meta.env.VITE_FIREBASE_API_KEY as string,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN as string,
databaseURL: import.meta.env.VITE_FIREBASE_DATABASE_URL as string,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID as string,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET as string,
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID as string,
appId: import.meta.env.VITE_FIREBASE_APP_ID as string,
}
const db = firebase.initializeApp(firebaseConfig).firestore()
const products = useFirestore(db.collection('products'), undefined, { autoDispose: false })
export { db, products }
Then I import products in a page, it shows correctly. However, whenever I run pnpm build, an error occurs.
> @ build /home/quan/wp/fe-test
> cross-env NODE_ENV=production vite-ssg build
[vite-ssg] Build for client...
vite v2.6.13 building for production...
✓ 83 modules transformed.
dist/index.html 1.07 KiB
dist/manifest.webmanifest 0.38 KiB
dist/ssr-manifest.json 7.62 KiB
dist/assets/app.8b837214.js 9.13 KiB / gzip: 3.84 KiB
dist/assets/README.897ddd5d.js 1.23 KiB / gzip: 0.56 KiB
dist/assets/virtual_pwa-register.925e73db.js 5.52 KiB / gzip: 2.31 KiB
dist/assets/about.e0917988.js 1.78 KiB / gzip: 0.76 KiB
dist/assets/[name].84d5e789.js 1.58 KiB / gzip: 0.94 KiB
dist/assets/404.75706864.js 0.92 KiB / gzip: 0.55 KiB
dist/assets/[...all].9575c05c.js 0.23 KiB / gzip: 0.20 KiB
dist/assets/home.417b4715.js 0.39 KiB / gzip: 0.29 KiB
dist/assets/app.ed883cd9.css 17.87 KiB / gzip: 4.29 KiB
dist/assets/vendor.bf27b286.js 98.65 KiB / gzip: 38.55 KiB
dist/assets/index.e1b28388.js 384.32 KiB / gzip: 92.75 KiB
PWA v0.11.3
mode generateSW
precache 18 entries (522.71 KiB)
files generated
dist/sw.js
dist/workbox-8ce990e4.js
[vite-ssg] Build for server...
vite v2.6.13 building SSR bundle for production...
✓ 49 modules transformed.
.vite-ssg-temp/manifest.webmanifest 0.38 KiB
.vite-ssg-temp/assets/style.9611e131.css 21.76 KiB
.vite-ssg-temp/main.js 549.39 KiB
[vite-ssg] Rendering Pages... (4)
[vite-ssg] Critical CSS generation enabled via `critters`
/home/quan/wp/fe-test/.vite-ssg-temp/main.js:3039
throw a2;
^
ReferenceError: Headers is not defined
at new qd (/home/quan/wp/fe-test/.vite-ssg-temp/main.js:4020:16)
at pd.g (/home/quan/wp/fe-test/.vite-ssg-temp/main.js:4004:10)
at X$1.k$1.ea (/home/quan/wp/fe-test/.vite-ssg-temp/main.js:4152:28)
at kc$1 (/home/quan/wp/fe-test/.vite-ssg-temp/main.js:3354:98)
at ic$1 (/home/quan/wp/fe-test/.vite-ssg-temp/main.js:3338:3)
at Id.k$1.Ha (/home/quan/wp/fe-test/.vite-ssg-temp/main.js:4492:95)
at Db (/home/quan/wp/fe-test/.vite-ssg-temp/main.js:3058:12)
ELIFECYCLE Command failed with exit code 1.
Please help.
@armenr did you end up solving the issue?
I think I'm having this same error, but for me vite build works fine but vite-ssg build fails.
Hello, I have the same issue using FullCalendar,
It require to import @fullcalendar/core/vdom to work :
https://fullcalendar.io/docs/vue
But this will work with a vite build and break with vite-ssg build
[vite-ssg] An internal error occurred.
[vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues
C:\Users\PC\WebstormProjects\ternat-front\node_modules\.pnpm\@[email protected]\node_modules\@fullcalendar\core\vdom.js:1
import { __extends } from 'tslib';
^^^^^^
SyntaxError: Cannot use import statement outside a module
My module:
import '@fullcalendar/core/vdom';
import FullCalendar from '@fullcalendar/vue3';
import type { UserModule } from '~/types';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const install: UserModule = ({ app, router, isClient }) => {
app.component('FullCalendar', FullCalendar);
};
I have the same error, but with vue macos
[vite-ssg] An internal error occurred.
[vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues
(node:19380) UnhandledPromiseRejectionWarning: /home/carlos/projects/python-cheatsheet/node_modules/.pnpm/[email protected]/node_modules/vue/macros.d.ts:1
import {
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Module.<anonymous> (/home/carlos/projects/python-cheatsheet/.vite-ssg-temp/main.cjs:12:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:19380) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:19380) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
It works fine with vite build command
@NunoSav - In my case, I didn't need static builds, and I had no benefit from static builds. For my use-case, Vitesse worked fine with standard SPA/PWA builds, and non static/server-side-generated.
So, unfortunately, no.
Also, the likely cause of the problem is not actually Vitesse...but rather some component or library/dependency you are using, that isn't SSR/SSG friendly.