Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ Importing CSS files is supported via `import "./foo.css"`. By default, generated

```js
// with the default external CSS:
import './foo.css'; // generates a minified .css file in the output directory
import './foo.css'; // generates a minified .css file in the output directory

// with `microbundle --css inline`:
import css from './foo.css';
console.log(css); // the generated minified stylesheet
console.log(css); // the generated minified stylesheet
```

**CSS Modules:** CSS files with names ending in `.module.css` are treated as a [CSS Modules](https://github.com/css-modules/css-modules).
Expand Down Expand Up @@ -235,11 +235,11 @@ It's also possible to configure repeatable short names for each mangled property

The `--define` option can be used to inject or replace build-time constants when bundling. In addition to injecting string or number constants, prefixing the define name with `@` allows injecting JavaScript expressions.

| Build command | Source code | Output |
|---------------|-------------|--------|
`microbundle --define VERSION=2` | `console.log(VERSION)` | `console.log(2)`
`microbundle --define API_KEY='abc123'` | `console.log(API_KEY)` | `console.log("abc123")`
`microbundle --define @assign=Object.assign` | `assign(a, b)` | `Object.assign(a, b)`
| Build command | Source code | Output |
| -------------------------------------------- | ---------------------- | ----------------------- |
| `microbundle --define VERSION=2` | `console.log(VERSION)` | `console.log(2)` |
| `microbundle --define API_KEY='abc123'` | `console.log(API_KEY)` | `console.log("abc123")` |
| `microbundle --define @assign=Object.assign` | `assign(a, b)` | `Object.assign(a, b)` |

### All CLI Options <a name="options"></a>

Expand All @@ -259,7 +259,7 @@ 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)
-f, --format Only build specified formats (any of modern,esm,cjs,umd or iife) (default modern,esm,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)
Expand Down
2 changes: 1 addition & 1 deletion src/prog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const toArray = val => (Array.isArray(val) ? val : val == null ? [] : [val]);
export default handler => {
const ENABLE_MODERN = process.env.MICROBUNDLE_MODERN !== 'false';

const DEFAULT_FORMATS = ENABLE_MODERN ? 'modern,es,cjs,umd' : 'es,cjs,umd';
const DEFAULT_FORMATS = ENABLE_MODERN ? 'modern,esm,cjs,umd' : 'esm,cjs,umd';

const cmd = type => (str, opts) => {
opts.watch = opts.watch || type === 'watch';
Expand Down