Skip to content

Commit

Permalink
chore: fix entries in package.json (#16)
Browse files Browse the repository at this point in the history
When importing a names export from this library in a Vercel functions,
it crashes:

> Error: Named export 'isString' not found. The requested module
'pure-parse' is a CommonJS module, which may not support all
module.exports as named exports.
> CommonJS modules can always be imported via the default export, for
example using:
> 
> import pkg from 'pure-parse';
> const { isString } = pkg;
> 
> [builder] module.exports as named exports.
> CommonJS modules can always be imported via the default export, for
example using:
> 
> import pkg from 'pure-parse';
> const { isString } = pkg;
> 

## How to test? (optional)

<!--
  Demonstrate the code is solid.
  Example: The exact commands you ran and their output,
  screenshots / videos if the pull request changes UI.
-->
  • Loading branch information
johannes-lindgren authored Jun 5, 2024
1 parent 9282feb commit fa01f5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/pure-parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@
],
"type": "module",
"module": "./dist/index.js",
"main": "./dist/index.umd.cjs",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.umd.cjs"
}
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down
2 changes: 1 addition & 1 deletion packages/pure-parse/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
lib: {
// Could also be a dictionary or array of multiple entry points
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
name: 'tsis',
name: 'pureParse',
fileName: 'index',
},
emptyOutDir: false,
Expand Down

0 comments on commit fa01f5e

Please sign in to comment.