Skip to content

Commit

Permalink
Merge pull request #149 from Andarist/emit-module-package-file-plugin
Browse files Browse the repository at this point in the history
chore(build): remove some scripts in favor of `emit-module-package-file`
  • Loading branch information
alexreardon committed Sep 28, 2022
2 parents e3fccef + 8e0b193 commit 3039cf5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@
"build:flow": "cp src/tiny-invariant.js.flow dist/tiny-invariant.cjs.js.flow",
"build:typescript": "tsc ./src/tiny-invariant.ts --emitDeclarationOnly --declaration --outDir ./dist",
"build:typescript:esm": "tsc ./src/tiny-invariant.ts --emitDeclarationOnly --declaration --outDir ./dist/esm",
"build:copy-esm-packagejson": "cp static/package-esm.json dist/esm/package.json",
"build:dist": "yarn rollup --config rollup.config.js",
"build": "yarn build:clean && yarn build:dist && yarn build:typescript && yarn build:typescript:esm && yarn build:copy-esm-packagejson",
"build": "yarn build:clean && yarn build:dist && yarn build:typescript && yarn build:typescript:esm",
"prepublishOnly": "yarn build"
},
"devDependencies": {
Expand Down
15 changes: 14 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ export default [
file: 'dist/esm/tiny-invariant.js',
format: 'esm',
},
plugins: [typescript({ module: 'ESNext' })],
plugins: [
typescript({ module: 'ESNext' }),
// https://github.com/rollup/rollup/blob/69ff4181e701a0fe0026d0ba147f31bc86beffa8/build-plugins/emit-module-package-file.ts
{
generateBundle() {
this.emitFile({
fileName: 'package.json',
source: `{ "type": "module" }\n`,
type: 'asset',
});
},
name: 'emit-module-package-file',
},
],
},
// CommonJS build
{
Expand Down
3 changes: 0 additions & 3 deletions static/package-esm.json

This file was deleted.

0 comments on commit 3039cf5

Please sign in to comment.