Skip to content

Commit

Permalink
modernize 2.0 preact build (#1269)
Browse files Browse the repository at this point in the history
This sets us up to modernize all of our builds by implementing microbundle on the preact package. This produces a commonjs build that is left as main because that's what people currently expect, an es build that gets used by webpack, etc under the module key, and a true es modern build that will get used conditionally by node v14 native esm when `import` is used. When `require` is used in v14, the commonjs build gets used.
  • Loading branch information
ChristopherBiscardi authored Sep 18, 2020
1 parent d76085f commit 8b4723f
Show file tree
Hide file tree
Showing 3 changed files with 316 additions and 43 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"node": "12.x"
},
"scripts": {
"build": "r -f cjs,esm -o dist --exclude 'babel-plugin-*,create-mdx,*loader,mdx,parcel-plugin-mdx,remark-*,*util'",
"build": "r -f cjs,esm -o dist --exclude 'babel-plugin-*,create-mdx,*loader,mdx,parcel-plugin-mdx,remark-*,*util,@mdx-js/preact' && yarn workspace @mdx-js/preact build",
"clean": "lerna exec \"rimraf dist node_modules\" && gatsby clean",
"docs": "gatsby develop",
"docs-build": "gatsby build",
Expand All @@ -36,6 +36,7 @@
"test-parser": "nyc --reporter lcov tape packages/remark-mdx/test/index.js",
"test-types": "lerna run test-types"
},
"dependencies": {},
"devDependencies": {
"@babel/core": "7.10.5",
"@babel/plugin-syntax-jsx": "7.10.4",
Expand Down Expand Up @@ -71,6 +72,7 @@
"lerna": "3.22.1",
"lint-staged": "10.2.11",
"memory-fs": "0.5.0",
"microbundle": "^0.12.3",
"prettier": "2.0.5",
"prettier-plugin-pkg": "0.7.0",
"react": "16.13.1",
Expand Down Expand Up @@ -136,6 +138,5 @@
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"dependencies": {}
}
}
18 changes: 14 additions & 4 deletions packages/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@
"Tim Neutkens <[email protected]>",
"Matija Marohnić <[email protected]>",
"Titus Wormer <[email protected]> (https://wooorm.com)",
"JounQin <[email protected]> (https://www.1stg.me)"
"JounQin <[email protected]> (https://www.1stg.me)",
"Chris Biscardi <[email protected]> (https://www.christopherbiscardi.com)"
],
"license": "MIT",
"main": "dist/cjs.js",
"module": "dist/esm.js",
"main": "dist/mdx-preact.js",
"module": "dist/mdx-preact.es.js",
"exports": {
"import": "./dist/mdx-preact.mjs",
"require": "./dist/mdx-preact.js"
},
"files": [
"dist"
],
Expand All @@ -31,12 +36,17 @@
"remark",
"mdxast"
],
"scripts": {
"build": "microbundle -f modern,es,cjs src/index.js"
},
"peerDependencies": {
"preact": "^10.4.6"
},
"devDependencies": {
"preact": "10.4.1",
"preact-render-to-string": "5.1.10"
},
"gitHead": "bf7deab69996449cb99c2217dff75e65855eb2c1"
"esmodule": "dist/foo.mjs",
"gitHead": "bf7deab69996449cb99c2217dff75e65855eb2c1",
"source": ""
}
Loading

0 comments on commit 8b4723f

Please sign in to comment.