Open IAPBenediktZwoelfer opened 1 year ago
app.js:56 TypeError: Cannot set properties of undefined (setting 'isHoliday') at node_modules/moment-business-days/index.js (index.js:7:11) at __require2 (chunk-DA74IYYC.js?v=31bda342:17:50) at index.js:248:1
Did you ever figure out how to fix it?
I fixed it by adding the following line to vite.config.js: resolve: {mainFields: []},
like this: (you can ignore the rest)
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
export default defineConfig({
build: {
//minify: false,
},
esbuild: { legalComments: 'none' },
resolve: {mainFields: []}, //<------ this fixed it!
plugins: [svelte()],
})
This solution didn't work for me:
resolve: {mainFields: []},
Does anyone have any idea how this can be fixed in a better way?
Environment: 1) vite 5.2.9 2) @originjs/vite-plugin-commonjs 1.0.3 3) @vitejs/plugin-vue 5.0.4
This solution didn't work for me:
resolve: {mainFields: []},
Does anyone have any idea how this can be fixed in a better way?
Environment:
- vite 5.2.9
- @originjs/vite-plugin-commonjs 1.0.3
- @vitejs/plugin-vue 5.0.4
I haven't tried the suggested fix, I decided to migrate to Luxon instead.
Yep, that is what I did as well
On Mon, Apr 22, 2024, 1:10 PM Kheang Hok Chin @.***> wrote:
This solution didn't work for me:
resolve: {mainFields: []},
Does anyone have any idea how this can be fixed in a better way?
Environment:
- vite 5.2.9
- @originjs/vite-plugin-commonjs 1.0.3
- @vitejs/plugin-vue 5.0.4
I haven't tried the suggested fix, I decided to migrate to Luxon instead.
— Reply to this email directly, view it on GitHub https://github.com/eduolalo/moment-business-days/issues/111#issuecomment-2069005730, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPUZ7OTGWLBDLNKQGZ5PTTY6TO3BAVCNFSM6AAAAABABEXIW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGAYDKNZTGA . You are receiving this because you commented.Message ID: @.***>
I think the issue is that the latest published version still uses require
: https://github.com/eduolalo/moment-business-days/blob/v1.2.0/index.js, which is not defined in vite.
The master branch supports ESM imports, but is not published on NPM
Importing from the master branch directly did work as suggested above.
"moment-business-days": "https://github.com/eduolalo/moment-business-days#master",
app.js:56 TypeError: Cannot set properties of undefined (setting 'isHoliday') at node_modules/moment-business-days/index.js (index.js:7:11) at __require2 (chunk-DA74IYYC.js?v=31bda342:17:50) at index.js:248:1