Skip to content

Commit

Permalink
updating package for esm modules to work with vite
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieCurnow committed Mar 13, 2022
1 parent dca2757 commit b9c0a8f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
"clipboard",
"clipboard.js"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.js",
"type": "module",
"main": "dist/cjs/index.js",
"types": "dist/esm/index.d.ts",
"module": "dist/esm/index.js",
"author": "Jamie Curnow",
"license": "MIT",
"private": false,
"scripts": {
"build": "tsc -d",
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"watch": "tsc --watch -d",
"test": "tsc"
"prepublish": "npm run build"
},
"peerDependencies": {},
"dependencies": {
Expand Down
7 changes: 7 additions & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "./dist/cjs"
},
}
11 changes: 8 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"outDir": "dist",
"target": "es5",
"outDir": "dist/esm",
"target": "ES2015",
"module": "ES2020",
"declaration": true,
"sourceMap": true,
"noImplicitAny": true,
"moduleResolution": "node",
"rootDir": "src",
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"strictNullChecks": true,
Expand All @@ -20,7 +24,8 @@
"./src/**/*"
],
"exclude": [
"./node_modules"
"./node_modules",
"dist"
],
"compileOnSave": true
}

1 comment on commit b9c0a8f

@JamieCurnow
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #4

Please sign in to comment.