Skip to content

Commit

Permalink
include TS types in bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanstitt committed Mar 22, 2022
1 parent 4fd7c49 commit 586c9e7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.."

yarn run vite build

tsc --emitDeclarationOnly

echo $DIR/src/editor/styles.scss $DIR/

$(npm bin)/sass $DIR/styles.scss > $DIR/styles.css
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"main": "./dist/formial.umd.js",
"module": "./dist/formial.es.js",
"source": "src/index.tsx",
"typings": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
Expand Down
2 changes: 1 addition & 1 deletion src/editor/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface Store {

interface StoreContextI {
store: Store
dispatch: React.Dispatch<Action> // (patch:any): void
dispatch: React.Dispatch<Action>
}

export const StoreContext = React.createContext(null as any as StoreContextI)
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noImplicitAny": false,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
Expand All @@ -26,8 +26,7 @@
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"downlevelIteration": true,
"noEmit": true
"downlevelIteration": true
},
"include": [
"src"
Expand Down
11 changes: 8 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,26 @@ export default defineConfig({
port: 7711,
},
base: './',

build: {
lib,
sourcemap: true,

emptyOutDir: true,
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: lib ? [
'react',
] : [],

plugins: [ ],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
// globals: {
// react: 'react',
// },
globals: {
react: 'react',
},
},
},
},
Expand Down

0 comments on commit 586c9e7

Please sign in to comment.