Skip to content

Commit

Permalink
fix: fixed #19 by adding proper es6 transpilation
Browse files Browse the repository at this point in the history
Also includes fixes with too much types being generated (vite)
and maybe locale fix
  • Loading branch information
icehaunter committed Feb 4, 2021
1 parent f7a71d9 commit e808a5e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
23 changes: 16 additions & 7 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,48 @@ import typescript from 'rollup-plugin-typescript2'
import postcss from 'rollup-plugin-postcss'
import path from 'path'

let tsconfigOverride = {
compilerOptions: {
target: 'ES6',
lib: ['ES2020', 'dom'],
rootDir: 'src/datepicker',
declarationDir: "dist/types"
},
include: ['src/**/*'],
}

export default [
{
output: {
format: 'esm',
file: 'dist/vue3-datepicker.esm.js',
},
plugins: [
typescript(),
typescript({ tsconfigOverride, useTsconfigDeclarationDir: true }),
vue(),
postcss({
plugins: []
plugins: [],
}),
],
},
{
output: {
format: 'cjs',
file: 'dist/vue3-datepicker.cjs.js',
exports: 'default'
exports: 'default',
},
plugins: [
typescript(),
typescript({ tsconfigOverride, useTsconfigDeclarationDir: true }),
vue({ css: false }),
postcss({
extract: path.resolve('dist', 'vue3-datepicker.css'),
extract: path.resolve('dist', 'vue3-datepicker.css'),
inject: false,
plugins: [],
}),

],
},
].map((v) => ({
...v,
input: 'src/datepicker/Datepicker.vue',
external: ['vue', 'date-fns', 'date-fns/fp'],
external: ['vue', 'date-fns', 'date-fns/fp', 'date-fns/locale'],
}))
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"private": false,
"name": "vue3-datepicker",
"version": "0.2.2",
"version": "0.2.3",
"publishConfig": {
"access": "public"
},
Expand All @@ -33,7 +33,7 @@
"main": "dist/vue3-datepicker.cjs.js",
"module": "dist/vue3-datepicker.esm.js",
"style": "dist/vue3-datepicker.css",
"types": "dist/src/datepicker/Datepicker.vue.d.ts",
"types": "dist/types/Datepicker.vue.d.ts",
"files": [
"src/datepicker",
"dist"
Expand Down
2 changes: 1 addition & 1 deletion src/datepicker/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default defineComponent({
},
setup(props, { emit }) {
const viewShown = ref('none' as 'year' | 'month' | 'day' | 'none')
const pageDate = ref(new Date())
const pageDate = ref<Date>(new Date())
const input = ref('')
watchEffect(() => {
Expand Down

0 comments on commit e808a5e

Please sign in to comment.