zunnzunn / vue-ganttastic

Simple, interactive and highly customizable Gantt chart component for Vue 3
https://zunnzunn.github.io/vue-ganttastic/
566 stars 141 forks source link

Build errors with dayjs imports #41

Open tranelearth opened 2 years ago

tranelearth commented 2 years ago

I am getting the following type of error for each of the dayjs imports at the top of node_modules/@infectoone/vue-ganttastic/dist/library.mjs when npm builds:

ERROR in ./node_modules/@infectoone/vue-ganttastic/dist/library.mjs 3:0-55 Module not found: Error: Can't resolve 'dayjs/plugin/isSameOrAfter' in '{local path}/node_modules/@infectoone/vue-ganttastic/dist' Did you mean 'isSameOrAfter.js'? BREAKING CHANGE: The request 'dayjs/plugin/isSameOrAfter' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.

A numbers of google searches have led me to add

module: {
    rules: [{
        test: /\.m?js/,
        resolve: {
            fullySpecified: false,
        }
    }]
}

to my webpack.config.js file, but that did not solve the problem.

I'm currently on version 3.2.31 of Vue, and 2.0.2 of vue-ganttastic.

robben779 commented 2 years ago

Same error:

isSameOrBefore.js isSameOrAfter.js isBetween.js customParseFormat.js

"vue": "^3.2.31", "@infectoone/vue-ganttastic": "^2.0.4",

thiagoreri commented 2 years ago

I have the same problem

dpschen commented 1 year ago

This was solved by https://github.com/InfectoOne/vue-ganttastic/pull/62. See the added .js suffix for these imports: https://github.com/InfectoOne/vue-ganttastic/blob/master/src/vue-ganttastic.ts#L3-L6