Skip to content

Commit

Permalink
Add jsxImportSource flag for new JSX runtime (#731)
Browse files Browse the repository at this point in the history
Co-authored-by: Leah <github.leah@hrmny.sh>
  • Loading branch information
vaneenige and ForsakenHarmony authored Sep 24, 2020
1 parent efb7cf3 commit d33a7ba
Show file tree
Hide file tree
Showing 6 changed files with 329 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-lies-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"microbundle": patch
---

Add jsxImportSource flag for new JSX runtime
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,28 +221,29 @@ For more info, run any command with the `--help` flag
$ microbundle watch --help
Options
-v, --version Displays current version
-i, --entry Entry module(s)
-o, --output Directory to place build files into
-f, --format Only build specified formats (any of modern,es,cjs,umd or iife) (default modern,es,cjs,umd)
-w, --watch Rebuilds on any change (default false)
--pkg-main Outputs files analog to package.json main entries (default true)
--target Specify your target environment (node or web) (default web)
--external Specify external dependencies, or 'none' (default peerDependencies and dependencies in package.json)
--globals Specify globals dependencies, or 'none'
--define Replace constants with hard-coded values
--alias Map imports to different modules
--compress Compress output using Terser
--no-compress Disable output compressing
--strict Enforce undefined global context and add "use strict"
--name Specify name exposed in UMD and IIFE builds
--cwd Use an alternative working directory (default .)
--sourcemap Generate source map (default true)
--raw Show raw byte size (default false)
--jsx A custom JSX pragma like React.createElement (default: h)
--tsconfig Specify the path to a custom tsconfig.json
--css-modules Configures .css to be treated as modules (default: null)
-h, --help Displays this message
-v, --version Displays current version
-i, --entry Entry module(s)
-o, --output Directory to place build files into
-f, --format Only build specified formats (any of modern,es,cjs,umd or iife) (default modern,es,cjs,umd)
-w, --watch Rebuilds on any change (default false)
--pkg-main Outputs files analog to package.json main entries (default true)
--target Specify your target environment (node or web) (default web)
--external Specify external dependencies, or 'none' (default peerDependencies and dependencies in package.json)
--globals Specify globals dependencies, or 'none'
--define Replace constants with hard-coded values
--alias Map imports to different modules
--compress Compress output using Terser
--no-compress Disable output compressing
--strict Enforce undefined global context and add "use strict"
--name Specify name exposed in UMD and IIFE builds
--cwd Use an alternative working directory (default .)
--sourcemap Generate source map (default true)
--raw Show raw byte size (default false)
--jsx A custom JSX pragma like React.createElement (default: h)
--jsxImportSource Specify the automatic import source for JSX like preact
--tsconfig Specify the path to a custom tsconfig.json
--css-modules Configures .css to be treated as modules (default: null)
-h, --help Displays this message
Examples
$ microbundle build --globals react=React,jquery=$
Expand Down
273 changes: 273 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"@babel/plugin-transform-regenerator": "^7.10.1",
"@babel/preset-env": "^7.11.0",
"@babel/preset-flow": "^7.10.1",
"@babel/preset-react": "^7.10.4",
"@rollup/plugin-alias": "^3.1.1",
"@rollup/plugin-babel": "^5.0.3",
"@rollup/plugin-commonjs": "^13.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ function createConfig(options, entry, format, writeMeta) {
pragma: options.jsx || 'h',
pragmaFrag: options.jsxFragment || 'Fragment',
typescript: !!useTypescript,
jsxImportSource: options.jsxImportSource || false,
},
}),
options.compress !== false && [
Expand Down
Loading

0 comments on commit d33a7ba

Please sign in to comment.