-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 1. change
process.env.NODE_ENV === 'development'
to `process.…
…env.NODE_ENV !== 'production'`, to make debug log widely used 2. build production lib that strip debug code 4. update readme 5. unify typescript version
- Loading branch information
Showing
12 changed files
with
653 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"description": "makes one way message responsive, enhance postMessage/storageEvent/electron IPC/chrome extension scripts", | ||
"scripts": { | ||
"build": "pnpm -r build", | ||
"test": "pnpm -r test -- run", | ||
"prepublish": "pnpm build", | ||
"publish": "pnpm -r publish", | ||
"lint": "eslint . --ext .ts" | ||
|
@@ -30,5 +31,10 @@ | |
"eslint-plugin-react-hooks": "^4.0.8", | ||
"husky": "^1.1.3" | ||
}, | ||
"pnpm": { | ||
"overrides": { | ||
"typescript": "5.5.3" | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { build, UserConfig } from 'vite' | ||
import dts from 'vite-plugin-dts' | ||
|
||
const defaultConfig: UserConfig = { | ||
plugins: [dts({ | ||
rollupTypes: true, | ||
exclude: ['test/**', 'demo/**'], | ||
})], | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
name: 'duplex-message', | ||
formats: ['umd', 'es'], | ||
fileName: (format) => (format === 'umd' ? 'index.umd.js' : 'index.es.js'), | ||
}, | ||
}, | ||
} | ||
|
||
const productionConfig: UserConfig = { | ||
build: { | ||
emptyOutDir: false, | ||
// @ts-ignore | ||
lib: { | ||
...defaultConfig.build!.lib, | ||
fileName: (format) => (format === 'umd' ? 'index.production.umd.js' : 'index.production.es.js') | ||
} | ||
}, | ||
define: { | ||
'process.env.NODE_ENV': '"production"', | ||
} | ||
} | ||
|
||
async function main() { | ||
await build(defaultConfig) | ||
await build(productionConfig) | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.