-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial typescript support as well as bundling for ES & CJS #245
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of these might not be necessary, I was working through which ones were needed or not but starting from a point where at least it was all working for us. |
||
"useDefineForClassFields": true, | ||
"module": "ESNext", | ||
"lib": ["ES2020", "DOM", "ESNext"], | ||
"skipLibCheck": true, | ||
"baseUrl": "./", | ||
"paths": { | ||
"#*": ["src/*"] | ||
}, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "preserve", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.js"], | ||
"references": [] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import { resolve } from 'path' | ||
import { defineConfig } from 'vite' | ||
import dts from 'vite-plugin-dts'; | ||
|
||
export default defineConfig({ | ||
export default defineConfig({ | ||
build: { | ||
sourcemap: true, | ||
lib: { | ||
// Could also be a dictionary or array of multiple entry points | ||
entry: resolve(__dirname, 'src/index.js'), | ||
entry: resolve(__dirname, 'src/index.ts'), | ||
filename: 'index', | ||
name: 'ScrollTimeline', | ||
// the proper extensions will be added | ||
fileName: (format, entryAlias) => `scroll-timeline${format=='iife'?'':'-' + format}.js`, | ||
formats: ['iife'], | ||
formats: ['iife', 'es', 'cjs'], | ||
}, | ||
minify: 'terser', | ||
terserOptions: { | ||
keep_classnames: /^((View|Scroll)Timeline)|CSS.*$/ | ||
keep_classnames: /^((View|Scroll)Timeline)|CSS.*$/, | ||
}, | ||
rollupOptions: { | ||
output: { | ||
|
@@ -25,4 +27,5 @@ export default defineConfig({ | |
}, | ||
} | ||
}, | ||
plugins: [dts()], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This creates the |
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may of had the
pretty: true
flag turned on momentarily that led to this autoformatting, happy to remove it.